pasika 0.10.24 → 0.10.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -196,6 +196,7 @@ declare const pasikaPlugin: {
196
196
  "guide-section-shape": _eslint_markdown.MarkdownRuleDefinition;
197
197
  "filename-case": eslint.Rule.RuleModule;
198
198
  "import-boundaries": eslint.Rule.RuleModule;
199
+ "import-spacing": eslint.Rule.RuleModule;
199
200
  "named-exports": eslint.Rule.RuleModule;
200
201
  "support-file-placement": eslint.Rule.RuleModule;
201
202
  "support-folder-shape": eslint.Rule.RuleModule;
@@ -587,6 +587,50 @@ var importBoundariesRule = {
587
587
  }
588
588
  };
589
589
 
590
+ // eslint/rules/import-spacing.ts
591
+ var MESSAGE = "Consecutive import declarations must not be separated by a blank line. See docs/next-codebase-guide/rules/exports-and-imports-rule.md";
592
+ function hasBlankLine(text) {
593
+ return /\r?\n[\t ]*\r?\n/u.test(text);
594
+ }
595
+ function removeBlankLines(text) {
596
+ const newline = text.includes("\r\n") ? "\r\n" : "\n";
597
+ return text.replace(/(?:\r?\n[\t ]*){2,}/gu, newline);
598
+ }
599
+ var importSpacingRule = {
600
+ meta: {
601
+ schema: [],
602
+ type: "layout",
603
+ fixable: "whitespace",
604
+ docs: {
605
+ description: "Disallow blank lines between consecutive import declarations."
606
+ }
607
+ },
608
+ create(context) {
609
+ return {
610
+ Program() {
611
+ const statements = context.sourceCode.ast.body;
612
+ for (let index = 1; index < statements.length; index += 1) {
613
+ const previous = statements[index - 1];
614
+ const current = statements[index];
615
+ if (previous?.type !== "ImportDeclaration" || current?.type !== "ImportDeclaration") continue;
616
+ const previousEnd = previous.range?.[1];
617
+ const currentStart = current.range?.[0];
618
+ if (previousEnd === void 0 || currentStart === void 0) continue;
619
+ const gap = context.sourceCode.text.slice(previousEnd, currentStart);
620
+ if (!hasBlankLine(gap)) continue;
621
+ context.report({
622
+ node: current,
623
+ message: MESSAGE,
624
+ fix(fixer) {
625
+ return fixer.replaceTextRange([previousEnd, currentStart], removeBlankLines(gap));
626
+ }
627
+ });
628
+ }
629
+ }
630
+ };
631
+ }
632
+ };
633
+
590
634
  // eslint/rules/no-mixed-concerns.ts
591
635
  var noMixedConcernsRule = {
592
636
  meta: {
@@ -7232,6 +7276,7 @@ function stringValues(value) {
7232
7276
  return value.elements.flatMap((element) => element.value.type === "String" ? [element.value.value] : []);
7233
7277
  }
7234
7278
  var SOURCE_GLOB_PATTERN = /(?:^|[^a-z])(?:[cm]?[jt]sx?)(?:[^a-z]|$)/i;
7279
+ var REQUIRED_NON_SOURCE_EXTENSIONS = ["css", "json", "md"];
7235
7280
  var DIRECT_ESLINT_PATTERN = /(?:^|&&|\|\||;)\s*(?:npx\s+)?eslint(?:\s|$)/;
7236
7281
  var REPOSITORY_ARGUMENT_PATTERN = /(?:^|\s)\.(?=\s|$)/;
7237
7282
  var PRETTIER_PATTERN = /\bprettier\b/;
@@ -7245,6 +7290,9 @@ function runsPrettier(command) {
7245
7290
  function runsNamedScript(command, name) {
7246
7291
  return command.includes(`npm run ${name}`);
7247
7292
  }
7293
+ function globIncludesExtension(glob, extension) {
7294
+ return new RegExp(`(?:^|[^a-z])${extension}(?:[^a-z]|$)`, "i").test(glob);
7295
+ }
7248
7296
  var lintSetupRule = {
7249
7297
  meta: {
7250
7298
  schema: [],
@@ -7294,22 +7342,28 @@ var lintSetupRule = {
7294
7342
  });
7295
7343
  }
7296
7344
  const lintStagedConfig = root.members.find((member) => memberName2(member) === "lint-staged");
7297
- const runsStagedScript = (name) => lintStagedConfig?.value.type === "Object" && lintStagedConfig.value.members.some(
7298
- (member) => stringValues(member.value).some((command) => runsNamedScript(command, name))
7345
+ const stagedMembers = lintStagedConfig?.value.type === "Object" ? lintStagedConfig.value.members : [];
7346
+ const runsStagedScriptForGlob = (name, matchesGlob) => stagedMembers.some(
7347
+ (member) => matchesGlob(memberName2(member)) && stringValues(member.value).some((command) => runsNamedScript(command, name))
7299
7348
  );
7300
- const hasStagedLintEntry = lintStagedConfig?.value.type === "Object" && lintStagedConfig.value.members.some(
7301
- (member) => SOURCE_GLOB_PATTERN.test(memberName2(member)) && stringValues(member.value).some((command) => runsNamedScript(command, "lint:staged"))
7349
+ const runsStagedScriptForExtension = (name, extension) => runsStagedScriptForGlob(name, (glob) => globIncludesExtension(glob, extension));
7350
+ const hasStagedSourceLint = runsStagedScriptForGlob("lint:staged", (glob) => SOURCE_GLOB_PATTERN.test(glob));
7351
+ const hasStagedNonSourceLint = REQUIRED_NON_SOURCE_EXTENSIONS.every(
7352
+ (extension) => runsStagedScriptForExtension("lint:staged", extension)
7302
7353
  );
7303
- if (!hasStagedLintEntry) {
7354
+ if (!hasStagedSourceLint || !hasStagedNonSourceLint) {
7304
7355
  context.report({
7305
7356
  node: lintStagedConfig ?? node,
7306
- message: 'package.json lint-staged must run "npm run lint:staged --" for staged JavaScript or TypeScript files.'
7357
+ message: 'package.json lint-staged must run "npm run lint:staged --" for staged JavaScript, TypeScript, CSS, Markdown, and JSON files.'
7307
7358
  });
7308
7359
  }
7309
- if (!runsStagedScript("format:staged")) {
7360
+ const hasStagedNonSourceFormat = REQUIRED_NON_SOURCE_EXTENSIONS.every(
7361
+ (extension) => runsStagedScriptForExtension("format:staged", extension)
7362
+ );
7363
+ if (!hasStagedNonSourceFormat) {
7310
7364
  context.report({
7311
7365
  node: lintStagedConfig ?? node,
7312
- message: 'package.json lint-staged must run "npm run format:staged --" for staged files ESLint does not already format.'
7366
+ message: 'package.json lint-staged must run "npm run format:staged --" for staged CSS, Markdown, and JSON files.'
7313
7367
  });
7314
7368
  }
7315
7369
  }
@@ -7728,6 +7782,7 @@ var pasikaNextjsAppRules = {
7728
7782
  // Framework-agnostic TypeScript rules.
7729
7783
  "filename-case": filenameCaseRule,
7730
7784
  "import-boundaries": importBoundariesRule,
7785
+ "import-spacing": importSpacingRule,
7731
7786
  "named-exports": namedExportsRule,
7732
7787
  "support-file-placement": supportFilePlacementRule,
7733
7788
  "support-folder-shape": supportFolderShapeRule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.24",
3
+ "version": "0.10.26",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,10 +54,13 @@
54
54
  "typecheck": "tsc --noEmit"
55
55
  },
56
56
  "lint-staged": {
57
- "!(*.ts|*.mts|*.cts|*.tsx|*.js|*.cjs|*.mjs|*.jsx)": "npm run format:staged --",
58
- "*.ts|*.mts|*.cts|*.tsx|*.js|*.cjs|*.mjs|*.jsx": [
57
+ "*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}": [
59
58
  "npm run lint:staged --",
60
59
  "npm run test:unit:staged --"
60
+ ],
61
+ "*.{css,json,md}": [
62
+ "npm run lint:staged --",
63
+ "npm run format:staged --"
61
64
  ]
62
65
  },
63
66
  "dependencies": {