safeword 0.32.0 → 0.33.0

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.
Files changed (30) hide show
  1. package/dist/{check-PNWSVUZG.js → check-OCPEU75B.js} +3 -3
  2. package/dist/{chunk-OIPRL2TA.js → chunk-G4RIZGNH.js} +10 -4
  3. package/dist/chunk-G4RIZGNH.js.map +1 -0
  4. package/dist/{chunk-ORQHKDT2.js → chunk-HSC7TELY.js} +4 -2
  5. package/dist/chunk-HSC7TELY.js.map +1 -0
  6. package/dist/chunk-RE5O6MEQ.js +76 -0
  7. package/dist/chunk-RE5O6MEQ.js.map +1 -0
  8. package/dist/{chunk-UPAH2FHH.js → chunk-UOUUMDSB.js} +8 -6
  9. package/dist/{chunk-UPAH2FHH.js.map → chunk-UOUUMDSB.js.map} +1 -1
  10. package/dist/cli.js +6 -6
  11. package/dist/{diff-HVRE7MNA.js → diff-5EESXIAP.js} +3 -3
  12. package/dist/index.js +2 -2
  13. package/dist/presets/typescript/index.js +2 -2
  14. package/dist/{reset-7DSNGPUW.js → reset-MOIC7UJX.js} +3 -3
  15. package/dist/{setup-R7LE7DTG.js → setup-7UMALSAE.js} +8 -4
  16. package/dist/setup-7UMALSAE.js.map +1 -0
  17. package/dist/{upgrade-V5ZS6LTQ.js → upgrade-I3KC4OHM.js} +8 -4
  18. package/dist/upgrade-I3KC4OHM.js.map +1 -0
  19. package/package.json +2 -2
  20. package/templates/SAFEWORD.md +106 -126
  21. package/templates/hooks/lib/quality.ts +1 -3
  22. package/dist/chunk-DSPWQAEB.js +0 -24
  23. package/dist/chunk-DSPWQAEB.js.map +0 -1
  24. package/dist/chunk-OIPRL2TA.js.map +0 -1
  25. package/dist/chunk-ORQHKDT2.js.map +0 -1
  26. package/dist/setup-R7LE7DTG.js.map +0 -1
  27. package/dist/upgrade-V5ZS6LTQ.js.map +0 -1
  28. /package/dist/{check-PNWSVUZG.js.map → check-OCPEU75B.js.map} +0 -0
  29. /package/dist/{diff-HVRE7MNA.js.map → diff-5EESXIAP.js.map} +0 -0
  30. /package/dist/{reset-7DSNGPUW.js.map → reset-MOIC7UJX.js.map} +0 -0
@@ -6,11 +6,11 @@ import {
6
6
  createProjectContext,
7
7
  getMissingPacks,
8
8
  reconcile
9
- } from "./chunk-UPAH2FHH.js";
9
+ } from "./chunk-UOUUMDSB.js";
10
10
  import "./chunk-YVZL7WO5.js";
11
11
  import {
12
12
  VERSION
13
- } from "./chunk-ORQHKDT2.js";
13
+ } from "./chunk-HSC7TELY.js";
14
14
  import {
15
15
  exists,
16
16
  readFileSafe
@@ -189,4 +189,4 @@ async function check(options) {
189
189
  export {
190
190
  check
191
191
  };
192
- //# sourceMappingURL=check-PNWSVUZG.js.map
192
+ //# sourceMappingURL=check-OCPEU75B.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-YVZL7WO5.js";
4
4
  import {
5
5
  VERSION
6
- } from "./chunk-ORQHKDT2.js";
6
+ } from "./chunk-HSC7TELY.js";
7
7
 
8
8
  // src/presets/typescript/eslint-configs/astro.ts
9
9
  import astroPlugin from "eslint-plugin-astro";
@@ -291,7 +291,13 @@ function scopeToFiles(configs, files) {
291
291
  var basePluginsUnscoped = [
292
292
  // Default ignores - always skip these directories
293
293
  {
294
- ignores: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.git/**"]
294
+ ignores: [
295
+ "**/node_modules/**",
296
+ "**/dist/**",
297
+ "**/build/**",
298
+ "**/.git/**",
299
+ "**/.claude/worktrees/**"
300
+ ]
295
301
  },
296
302
  // ESLint core recommended
297
303
  js.configs.recommended,
@@ -985,7 +991,7 @@ import turboPlugin from "eslint-plugin-turbo";
985
991
  var turboConfig = [turboPlugin.configs?.["flat/recommended"]].filter(Boolean);
986
992
 
987
993
  // src/presets/typescript/eslint-configs/vitest.ts
988
- import vitestPlugin from "eslint-plugin-vitest";
994
+ import vitestPlugin from "@vitest/eslint-plugin";
989
995
  var vitestConfig = [
990
996
  {
991
997
  name: "safeword/vitest",
@@ -1094,4 +1100,4 @@ export {
1094
1100
  eslintPlugin,
1095
1101
  typescript_default
1096
1102
  };
1097
- //# sourceMappingURL=chunk-OIPRL2TA.js.map
1103
+ //# sourceMappingURL=chunk-G4RIZGNH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/presets/typescript/eslint-configs/astro.ts","../src/presets/typescript/eslint-configs/base.ts","../src/presets/typescript/eslint-rules/no-accumulating-spread.ts","../src/presets/typescript/eslint-rules/no-incomplete-error-handling.ts","../src/presets/typescript/eslint-rules/no-re-export-all.ts","../src/presets/typescript/eslint-rules/index.ts","../src/presets/typescript/eslint-configs/overrides-cli.ts","../src/presets/typescript/eslint-configs/overrides-relaxed-types.ts","../src/presets/typescript/eslint-configs/playwright.ts","../src/presets/typescript/eslint-configs/recommended.ts","../src/presets/typescript/eslint-configs/recommended-nextjs.ts","../src/presets/typescript/eslint-configs/recommended-react.ts","../src/presets/typescript/eslint-configs/recommended-typescript.ts","../src/presets/typescript/eslint-configs/storybook.ts","../src/presets/typescript/eslint-configs/tailwind.ts","../src/presets/typescript/eslint-configs/tanstack-query.ts","../src/presets/typescript/eslint-configs/turbo.ts","../src/presets/typescript/eslint-configs/vitest.ts","../src/presets/typescript/index.ts"],"sourcesContent":["/**\n * ESLint configuration for Astro projects\n *\n * Applies to .astro files.\n * Includes recommended rules plus LLM-critical security/convention rules.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport astroPlugin from 'eslint-plugin-astro';\n\n/**\n * Astro config\n *\n * Includes:\n * - 8 recommended rules (all at error)\n * - 33 accessibility rules from jsx-a11y-strict (adapted for Astro)\n * - 3 LLM-critical rules: no-set-html-directive (XSS), no-unsafe-inline-scripts (CSP), no-exports-from-components\n *\n * Note: jsx-a11y rules work with Astro files because eslint-plugin-astro\n * provides wrapped versions that understand Astro's JSX-like syntax.\n * Using eslint-plugin-jsx-a11y directly on Astro files does NOT work.\n */\nexport const astroConfig: any[] = [\n // Spread flat/recommended (5 config objects: plugin setup, file patterns, prettier overrides, rules)\n ...astroPlugin.configs['flat/recommended'],\n\n // Accessibility rules adapted for Astro (requires eslint-plugin-jsx-a11y installed)\n ...astroPlugin.configs['flat/jsx-a11y-strict'],\n\n // Add LLM-critical rules\n {\n name: 'safeword/astro',\n rules: {\n // XSS prevention - LLMs often use set:html for rendering user content\n 'astro/no-set-html-directive': 'error',\n\n // CSP safety - inline scripts can break Content Security Policy\n 'astro/no-unsafe-inline-scripts': 'error',\n\n // Astro convention - LLMs try to export from .astro components (not allowed)\n 'astro/no-exports-from-components': 'error',\n },\n },\n];\n","/**\n * Base ESLint plugins shared between JS and TypeScript configs\n *\n * These plugins work without type information and are included in both\n * `recommended` (JS) and `recommendedTypeScript` configs.\n */\n\nimport js from '@eslint/js';\nimport eslintComments from '@eslint-community/eslint-plugin-eslint-comments';\nimport { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';\nimport { importX } from 'eslint-plugin-import-x';\nimport pluginPromise from 'eslint-plugin-promise';\nimport { configs as regexpConfigs } from 'eslint-plugin-regexp';\nimport pluginSecurity from 'eslint-plugin-security';\nimport simpleImportSort from 'eslint-plugin-simple-import-sort';\nimport { configs as sonarConfigs } from 'eslint-plugin-sonarjs';\nimport unicorn from 'eslint-plugin-unicorn';\n\nimport { rules as safewordRules } from '../eslint-rules/index.js';\n\n/**\n * File patterns for base JS/TS rules\n * Excludes .astro, .vue, .svelte which use different parsers\n */\nexport const JS_TS_FILES = ['**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}'];\n\n/**\n * Add files restriction to config objects.\n * Handles both single config objects and arrays of configs.\n * Skips config objects that only have ignores (global ignores).\n * Skips config objects that already have files set.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages\nfunction scopeConfigToFiles(config: any, files: string[]): any {\n // Skip global ignores (config with only ignores property)\n if (config.ignores && Object.keys(config).length === 1) {\n return config;\n }\n // Skip configs that already have files set\n if (config.files) {\n return config;\n }\n // Add files restriction\n return { ...config, files };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages\nfunction scopeToFiles(configs: any[], files: string[]): any[] {\n return configs.flatMap(config => {\n // Handle arrays (third-party configs may be arrays)\n if (Array.isArray(config)) {\n return config.map(c => scopeConfigToFiles(c, files));\n }\n return scopeConfigToFiles(config, files);\n });\n}\n\n/**\n * Base plugins - shared between JS and TS configs\n * Does NOT include JSDoc (different config per language) or Prettier (must be last)\n *\n * Note: Uses any[] because ESLint plugin types are incompatible across packages.\n * Runtime validation by ESLint ensures correctness.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages\nconst basePluginsUnscoped: any[] = [\n // Default ignores - always skip these directories\n {\n ignores: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.git/**',\n '**/.claude/worktrees/**',\n ],\n },\n\n // ESLint core recommended\n js.configs.recommended,\n\n // Code style and design rules - catches common LLM patterns\n {\n name: 'safeword/code-style',\n rules: {\n 'no-unneeded-ternary': 'error', // x ? true : false → x\n 'prefer-template': 'error', // 'a' + b → `a${b}`\n 'dot-notation': 'error', // obj[\"prop\"] → obj.prop\n 'object-shorthand': 'error', // { foo: foo } → { foo }\n 'no-extra-boolean-cast': 'error', // !!value → Boolean(value) or value\n 'prefer-object-spread': 'error', // Object.assign({}, x) → { ...x }\n 'logical-assignment-operators': 'error', // x = x ?? y → x ??= y\n 'operator-assignment': 'error', // x = x + 1 → x += 1\n curly: 'error', // Require braces around if/else/for/while\n 'arrow-body-style': ['error', 'as-needed'], // () => { return x } → () => x\n 'prefer-arrow-callback': ['error', { allowNamedFunctions: true }], // function() {} → () => {}\n // Design constraints - forces LLMs to decompose code\n 'max-depth': ['error', 4], // Forces early returns, avoids deep nesting\n 'max-params': ['error', 5], // Forces object params or decomposition\n complexity: ['error', 10], // Cyclomatic complexity - LLMs write dense, complex code\n 'max-nested-callbacks': ['error', 3], // Prevents callback hell in async code\n eqeqeq: ['error', 'always', { null: 'ignore' }], // === required, except x == null\n 'preserve-caught-error': 'error', // Re-throw with { cause: error } to preserve stack\n },\n },\n\n // Import validation\n importX.flatConfigs.recommended,\n {\n name: 'safeword/import-rules',\n settings: {\n 'import-x/resolver-next': [createTypeScriptImportResolver()],\n },\n rules: {\n 'import-x/no-duplicates': 'error', // LLMs create duplicate imports\n 'import-x/no-cycle': 'error', // Circular dependencies A → B → A\n 'import-x/no-self-import': 'error', // File imports itself (copy-paste bug)\n // Turn off rules with high false-positive rate - documented justification:\n //\n // no-named-as-default: Flags valid patterns like `import Button from './Button'`\n // when Button.tsx has both default and named exports. Very common in React.\n // Issue: https://github.com/import-js/eslint-plugin-import/issues/1618\n 'import-x/no-named-as-default': 'off',\n //\n // no-named-as-default-member: Same issue - flags accessing static members\n // on default imports, e.g., `Button.displayName`. Common React pattern.\n 'import-x/no-named-as-default-member': 'off',\n },\n },\n\n // Code quality / complexity\n sonarConfigs.recommended,\n {\n name: 'safeword/sonarjs-rules',\n rules: {\n // Enable design rules (off by default but valuable for clean code)\n 'sonarjs/no-collapsible-if': 'error', // if(a) { if(b) } → if(a && b)\n 'sonarjs/no-nested-switch': 'error', // Switch inside switch is a smell\n 'sonarjs/prefer-immediate-return': 'error', // const x = y; return x → return y\n 'sonarjs/no-inconsistent-returns': 'error', // Some paths return, some don't\n },\n },\n\n // Security - detect common vulnerabilities\n pluginSecurity.configs.recommended,\n {\n name: 'safeword/security-rules',\n rules: {\n // Critical security rules at error (LLMs ignore warnings)\n 'security/detect-bidi-characters': 'error', // Trojan Source attacks\n 'security/detect-eval-with-expression': 'error',\n 'security/detect-non-literal-fs-filename': 'error',\n 'security/detect-non-literal-regexp': 'error',\n 'security/detect-non-literal-require': 'error',\n 'security/detect-child-process': 'error',\n 'security/detect-unsafe-regex': 'error',\n 'security/detect-disable-mustache-escape': 'error',\n 'security/detect-no-csrf-before-method-override': 'error',\n // Escalate all to error (LLMs ignore warnings)\n 'security/detect-object-injection': 'error',\n 'security/detect-possible-timing-attacks': 'error',\n 'security/detect-buffer-noassert': 'error',\n 'security/detect-new-buffer': 'error',\n 'security/detect-pseudoRandomBytes': 'error',\n },\n },\n\n // Promise handling - catches floating promises (critical for LLM code)\n pluginPromise.configs['flat/recommended'],\n {\n name: 'safeword/promise-rules',\n rules: {\n 'promise/no-multiple-resolved': 'error', // Catches missing return after resolve\n // LLMs mix callback/promise paradigms - escalate to error\n 'promise/no-callback-in-promise': 'error',\n 'promise/no-nesting': 'error',\n 'promise/no-promise-in-callback': 'error',\n 'promise/no-return-in-finally': 'error',\n 'promise/valid-params': 'error',\n },\n },\n\n // Regexp - catches ReDoS vulnerabilities and malformed regex\n regexpConfigs['flat/recommended'],\n {\n name: 'safeword/regexp-rules',\n rules: {\n // Escalate warn rules to error (LLMs ignore warnings)\n 'regexp/confusing-quantifier': 'error',\n 'regexp/no-empty-alternative': 'error',\n 'regexp/no-lazy-ends': 'error',\n 'regexp/no-potentially-useless-backreference': 'error',\n 'regexp/no-useless-flag': 'error',\n 'regexp/optimal-lookaround-quantifier': 'error',\n },\n },\n\n // Modern JS enforcement - strict for agents\n unicorn.configs.recommended,\n {\n name: 'safeword/unicorn-rules',\n rules: {\n // Keep off - documented justification for each:\n //\n // no-process-exit: CLI tools legitimately use process.exit() for:\n // - Error handling with non-zero exit codes\n // - Clean shutdown after completing work\n // Forcing throw-only would break CLI UX and exit code contracts.\n 'unicorn/no-process-exit': 'off',\n //\n // prefer-module: CommonJS is still valid in Node.js ecosystem:\n // - Config files (jest.config.js, .eslintrc.cjs)\n // - Packages with CJS-only dependencies\n // - Gradual ESM migration in progress\n 'unicorn/prefer-module': 'off',\n // Escalated to error for LLM code\n 'unicorn/switch-case-braces': 'error',\n 'unicorn/catch-error-name': 'error',\n 'unicorn/no-array-reduce': 'error', // LLMs write confusing reduce\n 'unicorn/prevent-abbreviations': [\n 'error',\n {\n allowList: {\n ctx: true, // context\n req: true, // request\n res: true, // response\n err: true, // error\n dir: true, // directory\n pkg: true, // package\n env: true, // environment\n args: true, // arguments\n params: true, // parameters\n props: true, // properties\n ref: true, // reference\n src: true, // source\n dest: true, // destination\n db: true, // database\n fn: true, // function\n cb: true, // callback\n acc: true, // accumulator\n prev: true, // previous\n curr: true, // current\n i: true, // index\n j: true, // index\n k: true, // index\n },\n },\n ],\n 'unicorn/no-null': 'error', // Use undefined\n 'unicorn/no-array-for-each': 'error', // Use for...of\n 'unicorn/no-negated-condition': 'error', // Clearer conditionals\n // Cherry-picked from 'all' config - high value for LLM code\n 'unicorn/no-unused-properties': 'error', // Dead code in enum-like objects\n 'unicorn/consistent-destructuring': 'error', // Don't mix props.x and {x} = props\n 'unicorn/prefer-import-meta-properties': 'error', // import.meta.dirname > __dirname\n },\n },\n\n // Import sorting - auto-fixable, reduces noise\n {\n name: 'safeword/import-sort',\n plugins: { 'simple-import-sort': simpleImportSort },\n rules: {\n 'simple-import-sort/imports': 'error',\n 'simple-import-sort/exports': 'error',\n 'import-x/order': 'off', // Disable in favor of simple-import-sort\n },\n },\n\n // Safeword custom rules - LLM-specific patterns\n {\n name: 'safeword/custom-rules',\n plugins: { safeword: { rules: safewordRules } },\n rules: {\n 'safeword/no-incomplete-error-handling': 'error',\n 'safeword/no-accumulating-spread': 'error', // O(n²) reduce pattern\n 'safeword/no-re-export-all': 'error', // Hurts tree-shaking\n },\n },\n\n // ESLint native: flag stale disable directives (ESLint 9 default is warn, we want error)\n {\n name: 'safeword/linter-options',\n linterOptions: {\n reportUnusedDisableDirectives: 'error',\n },\n },\n\n // ESLint disable comment governance - prevents broad/undocumented suppressions\n {\n name: 'safeword/eslint-comments',\n plugins: { 'eslint-comments': eslintComments },\n rules: {\n 'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],\n 'eslint-comments/no-unlimited-disable': 'error', // Must name specific rule\n 'eslint-comments/require-description': ['error', { ignore: ['eslint-enable'] }], // Must explain why\n 'eslint-comments/no-duplicate-disable': 'error', // No redundant disables\n 'eslint-comments/no-unused-enable': 'error', // No orphaned enables\n },\n },\n];\n\n/**\n * Base plugins scoped to JS/TS files only.\n * Prevents rules from running on .astro, .vue, .svelte files which use different parsers.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages\nexport const basePlugins: any[] = scopeToFiles(basePluginsUnscoped, JS_TS_FILES);\n\n/**\n * Prettier config - must be last to disable conflicting rules\n */\n\nexport { default as prettierConfig } from 'eslint-config-prettier';\n","/**\n * Rule: no-accumulating-spread\n *\n * Detects spread operator on accumulators in reduce callbacks, which causes\n * O(n²) time complexity. This is a common LLM performance mistake.\n *\n * Bad (O(n²)):\n * items.reduce((acc, item) => ({ ...acc, [item.id]: item }), {})\n * items.reduce((acc, item) => [...acc, item.name], [])\n *\n * Good (O(n)):\n * items.reduce((acc, item) => { acc[item.id] = item; return acc; }, {})\n * items.reduce((acc, item) => { acc.push(item.name); return acc; }, [])\n *\n * Or better - avoid reduce entirely:\n * Object.fromEntries(items.map(item => [item.id, item]))\n * items.map(item => item.name)\n */\n\nimport type { Rule } from 'eslint';\nimport type {\n ArrowFunctionExpression,\n CallExpression,\n FunctionExpression,\n Node,\n SpreadElement,\n} from 'estree';\n\n/**\n * Check if a node is a call to .reduce()\n */\nfunction isReduceCall(node: CallExpression): boolean {\n const { callee } = node;\n return (\n callee.type === 'MemberExpression' &&\n callee.property.type === 'Identifier' &&\n callee.property.name === 'reduce'\n );\n}\n\n/**\n * Get the accumulator parameter name from a reduce callback\n */\nfunction getAccumulatorName(\n callback: ArrowFunctionExpression | FunctionExpression,\n): string | undefined {\n const firstParameter = callback.params[0];\n if (firstParameter?.type === 'Identifier') {\n return firstParameter.name;\n }\n return undefined;\n}\n\n/**\n * Check if a spread element spreads the accumulator\n */\nfunction spreadsAccumulator(spread: SpreadElement, accName: string): boolean {\n return spread.argument.type === 'Identifier' && spread.argument.name === accName;\n}\n\n/**\n * Check object expression properties for accumulator spread.\n */\nfunction findSpreadInObject(\n node: Node & { type: 'ObjectExpression' },\n accName: string,\n): SpreadElement | undefined {\n for (const property of node.properties) {\n if (property.type === 'SpreadElement' && spreadsAccumulator(property, accName)) {\n return property;\n }\n }\n return undefined;\n}\n\n/**\n * Check array expression elements for accumulator spread.\n */\nfunction findSpreadInArray(\n node: Node & { type: 'ArrayExpression' },\n accName: string,\n): SpreadElement | undefined {\n for (const element of node.elements) {\n if (element?.type === 'SpreadElement' && spreadsAccumulator(element, accName)) {\n return element;\n }\n }\n return undefined;\n}\n\n/**\n * Recursively check if an expression contains a spread of the accumulator\n */\nfunction containsAccumulatorSpread(node: Node, accName: string): SpreadElement | undefined {\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- Only specific node types can contain spreads; all others return undefined via default\n switch (node.type) {\n case 'SpreadElement': {\n return spreadsAccumulator(node, accName) ? node : undefined;\n }\n\n case 'ObjectExpression': {\n return findSpreadInObject(node, accName);\n }\n\n case 'ArrayExpression': {\n return findSpreadInArray(node, accName);\n }\n\n case 'ConditionalExpression': {\n return (\n containsAccumulatorSpread(node.consequent, accName) ??\n containsAccumulatorSpread(node.alternate, accName)\n );\n }\n\n case 'LogicalExpression': {\n return (\n containsAccumulatorSpread(node.left, accName) ??\n containsAccumulatorSpread(node.right, accName)\n );\n }\n\n default: {\n return undefined;\n }\n }\n}\n\n/**\n * Check arrow function body for accumulator spread\n */\nfunction checkArrowBody(\n body: ArrowFunctionExpression['body'],\n accName: string,\n): SpreadElement | undefined {\n // Direct return: (acc, item) => ({ ...acc, ... })\n if (body.type === 'ObjectExpression' || body.type === 'ArrayExpression') {\n return containsAccumulatorSpread(body, accName);\n }\n\n // Parenthesized or conditional\n if (body.type === 'ConditionalExpression' || body.type === 'LogicalExpression') {\n return containsAccumulatorSpread(body, accName);\n }\n\n // Block body - check return statements\n if (body.type === 'BlockStatement') {\n for (const stmt of body.body) {\n if (stmt.type === 'ReturnStatement' && stmt.argument) {\n const found = containsAccumulatorSpread(stmt.argument, accName);\n if (found) return found;\n }\n }\n }\n\n return undefined;\n}\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description: 'Disallow spreading accumulator in reduce (causes O(n²) complexity)',\n recommended: true,\n },\n messages: {\n accumulatingSpread:\n 'Spreading accumulator in reduce() causes O(n²) complexity. ' +\n 'Mutate the accumulator instead, or use map/filter/Object.fromEntries.',\n },\n schema: [],\n },\n\n create(context) {\n return {\n CallExpression(node: CallExpression) {\n if (!isReduceCall(node)) return;\n\n const callback = node.arguments[0];\n if (\n !callback ||\n (callback.type !== 'ArrowFunctionExpression' && callback.type !== 'FunctionExpression')\n ) {\n return;\n }\n\n const accName = getAccumulatorName(callback);\n if (!accName) return;\n\n const spreadNode = checkArrowBody(callback.body, accName);\n if (spreadNode) {\n context.report({\n node: spreadNode,\n messageId: 'accumulatingSpread',\n });\n }\n },\n };\n },\n};\n\nexport default rule;\n","/**\n * Rule: no-incomplete-error-handling\n *\n * Detects catch blocks that log an error but don't rethrow or return,\n * which swallows the error silently. This is a common LLM mistake.\n *\n * Bad:\n * catch (error) { console.error(error); } // swallowed!\n *\n * Good:\n * catch (error) { console.error(error); throw error; }\n * catch (error) { console.error(error); return null; }\n * catch (error) { throw new AppError('context', { cause: error }); }\n */\n\nimport type { Rule } from 'eslint';\nimport type { CallExpression, CatchClause, Statement } from 'estree';\n\nconst LOG_METHODS = new Set(['log', 'error', 'warn', 'info', 'debug', 'trace']);\n\nconst LOG_OBJECTS = new Set(['console', 'logger', 'log']);\n\n/**\n * Checks if a call expression is a logging call (console.log, logger.error, etc.)\n * @param node\n */\nfunction isLoggingCall(node: CallExpression): boolean {\n const { callee } = node;\n\n // console.error(...), logger.error(...), etc.\n if (\n callee.type === 'MemberExpression' &&\n callee.object.type === 'Identifier' &&\n callee.property.type === 'Identifier'\n ) {\n const object = callee.object.name.toLowerCase();\n const method = callee.property.name.toLowerCase();\n return LOG_OBJECTS.has(object) && LOG_METHODS.has(method);\n }\n\n return false;\n}\n\n/**\n * Check if a single statement terminates control flow.\n */\nfunction isTerminatingBranch(stmt: Statement): boolean {\n if (stmt.type === 'ThrowStatement' || stmt.type === 'ReturnStatement') {\n return true;\n }\n if (stmt.type === 'BlockStatement') {\n return hasTerminatingStatement(stmt.body);\n }\n return false;\n}\n\n/**\n * Check if an if statement terminates (both branches must terminate).\n */\nfunction ifStatementTerminates(stmt: Statement & { type: 'IfStatement' }): boolean {\n const consequentTerminates = isTerminatingBranch(stmt.consequent);\n const alternateTerminates = stmt.alternate ? isTerminatingBranch(stmt.alternate) : false;\n return consequentTerminates && alternateTerminates;\n}\n\n/**\n * Checks if statements include a throw or return (error is properly handled)\n * @param statements\n */\nfunction hasTerminatingStatement(statements: Statement[]): boolean {\n for (const stmt of statements) {\n if (stmt.type === 'ThrowStatement' || stmt.type === 'ReturnStatement') {\n return true;\n }\n if (stmt.type === 'IfStatement' && ifStatementTerminates(stmt)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if a single statement is a logging call.\n */\nfunction isLoggingStatement(stmt: Statement): boolean {\n return (\n stmt.type === 'ExpressionStatement' &&\n stmt.expression.type === 'CallExpression' &&\n isLoggingCall(stmt.expression)\n );\n}\n\n/**\n * Get nested statements from a statement (for recursive search).\n */\nfunction getNestedStatements(stmt: Statement): Statement[] {\n if (stmt.type === 'BlockStatement') {\n return stmt.body;\n }\n if (stmt.type === 'IfStatement') {\n const nested = [stmt.consequent];\n if (stmt.alternate) nested.push(stmt.alternate);\n return nested;\n }\n return [];\n}\n\n/**\n * Recursively checks if statements include a logging call (searches nested blocks)\n * @param statements\n */\nfunction containsLoggingCall(statements: Statement[]): boolean {\n for (const stmt of statements) {\n if (isLoggingStatement(stmt)) return true;\n\n const nested = getNestedStatements(stmt);\n if (nested.length > 0 && containsLoggingCall(nested)) return true;\n }\n return false;\n}\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description: 'Disallow catch blocks that log but do not rethrow or return',\n recommended: true,\n },\n messages: {\n incompleteErrorHandling:\n 'Catch block logs error but does not rethrow or return. This swallows the error silently.',\n },\n schema: [],\n },\n\n create(context) {\n return {\n CatchClause(node: CatchClause) {\n const { body } = node;\n if (body.type !== 'BlockStatement') return;\n\n const statements = body.body;\n\n // Only flag if there's a logging call but no terminating statement\n if (containsLoggingCall(statements) && !hasTerminatingStatement(statements)) {\n context.report({\n node,\n messageId: 'incompleteErrorHandling',\n });\n }\n },\n };\n },\n};\n\nexport default rule;\n","/**\n * Rule: no-re-export-all\n *\n * Disallows `export * from` statements which re-export all exports from\n * another module. This pattern hurts tree-shaking and makes dependencies\n * unclear. LLMs often use this for convenience without understanding\n * the bundle size implications.\n *\n * Bad:\n * export * from './utils';\n * export * from '@/components';\n *\n * Good:\n * export { foo, bar } from './utils';\n * export { Button, Modal } from '@/components';\n *\n * Note: `export * as namespace from` is allowed as it creates a named export.\n */\n\nimport type { Rule } from 'eslint';\nimport type { ExportAllDeclaration } from 'estree';\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n docs: {\n description: 'Disallow wildcard re-exports (export * from)',\n recommended: true,\n },\n messages: {\n noReExportAll:\n 'Avoid `export * from`. Use named exports for better tree-shaking and clearer dependencies.',\n },\n schema: [],\n },\n\n create(context) {\n return {\n ExportAllDeclaration(node: ExportAllDeclaration) {\n // Allow `export * as namespace from` - this creates a named export\n if (node.exported) {\n return;\n }\n\n context.report({\n node,\n messageId: 'noReExportAll',\n });\n },\n };\n },\n};\n\nexport default rule;\n","/**\n * Safeword custom ESLint rules\n */\n\nimport noAccumulatingSpread from './no-accumulating-spread.js';\nimport noIncompleteErrorHandling from './no-incomplete-error-handling.js';\nimport noReExportAll from './no-re-export-all.js';\n\nexport const rules = {\n 'no-accumulating-spread': noAccumulatingSpread,\n 'no-incomplete-error-handling': noIncompleteErrorHandling,\n 'no-re-export-all': noReExportAll,\n};\n","/**\n * CLI Tool preset\n *\n * Disables security rules that produce false positives for CLI tools,\n * build tools, and scripts that work with dynamic file paths and\n * shell commands by design.\n *\n * Usage:\n * import { defineConfig } from 'eslint/config';\n * import safeword from 'safeword/eslint';\n * export default defineConfig([\n * ...safeword.configs.recommendedTypeScript,\n * safeword.configs.cli,\n * ]);\n */\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages\nexport const cliConfig: any = {\n name: 'safeword/cli',\n rules: {\n // CLI tools read/write user-provided paths — not an injection vector\n 'security/detect-non-literal-fs-filename': 'off',\n // CLI tools index objects with user-provided keys (parsed JSON/YAML)\n 'security/detect-object-injection': 'off',\n // CLI tools execute commands from PATH — this is expected, not an attack\n 'sonarjs/no-os-command-from-path': 'off',\n 'sonarjs/os-command': 'off',\n // CLI tools compare mixed types from parsed user input\n 'sonarjs/different-types-comparison': 'off',\n },\n};\n","/**\n * Relaxed Type-Checking preset\n *\n * Disables strict TypeScript rules that produce false positives when\n * code handles data without compile-time types: JSON parsing, YAML\n * loading, API responses, dynamic config files, and user input.\n *\n * Usage:\n * import { defineConfig } from 'eslint/config';\n * import safeword from 'safeword/eslint';\n * export default defineConfig([\n * ...safeword.configs.recommendedTypeScript,\n * safeword.configs.relaxedTypes,\n * ]);\n */\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages\nexport const relaxedTypesConfig: any = {\n name: 'safeword/relaxed-types',\n rules: {\n // External data (JSON, YAML, API responses) has no compile-time types\n '@typescript-eslint/no-unsafe-argument': 'off',\n '@typescript-eslint/no-unsafe-assignment': 'off',\n '@typescript-eslint/no-unsafe-call': 'off',\n '@typescript-eslint/no-unsafe-member-access': 'off',\n '@typescript-eslint/no-unsafe-return': 'off',\n // Boolean checks on untyped values are valid guards, not unnecessary\n '@typescript-eslint/strict-boolean-expressions': 'off',\n '@typescript-eslint/no-unnecessary-condition': 'off',\n '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',\n // Fallback operators on untyped values are intentional\n '@typescript-eslint/prefer-nullish-coalescing': 'off',\n // Template literals with untyped values are common in logging/output\n '@typescript-eslint/restrict-template-expressions': 'off',\n },\n};\n","/**\n * ESLint configuration for Playwright e2e tests\n *\n * Applies ONLY to e2e test files to avoid conflicts with vitest:\n * - *.e2e.ts files (explicit e2e naming)\n * - Files in e2e/ directories\n *\n * Does NOT apply to regular *.test.ts files (those are vitest).\n *\n * All rules escalated to error (LLMs ignore warnings).\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport playwrightPlugin from 'eslint-plugin-playwright';\n\n/**\n * Playwright e2e test linting config\n *\n * Based on recommended config with all warns escalated to error.\n *\n * File patterns target only e2e tests to avoid vitest conflicts:\n * - Explicit e2e suffix (e.g., login.e2e.ts)\n * - Test/spec files in e2e directories only\n */\nexport const playwrightConfig: any[] = [\n {\n name: 'safeword/playwright',\n files: ['**/*.e2e.{ts,tsx,js,jsx}', '**/e2e/**/*.{test,spec}.{ts,tsx,js,jsx}'],\n plugins: {\n playwright: playwrightPlugin,\n },\n rules: {\n // From recommended - already at error\n 'playwright/missing-playwright-await': 'error',\n 'playwright/no-focused-test': 'error',\n 'playwright/no-networkidle': 'error',\n 'playwright/no-standalone-expect': 'error',\n 'playwright/no-unsafe-references': 'error',\n 'playwright/no-unused-locators': 'error',\n 'playwright/no-wait-for-navigation': 'error',\n 'playwright/prefer-web-first-assertions': 'error',\n 'playwright/valid-describe-callback': 'error',\n 'playwright/valid-expect': 'error',\n 'playwright/valid-expect-in-promise': 'error',\n 'playwright/valid-test-tags': 'error',\n 'playwright/valid-title': 'error',\n\n // Escalated from warn to error (LLMs ignore warnings)\n 'playwright/expect-expect': 'error',\n 'playwright/max-nested-describe': 'error',\n 'playwright/no-conditional-expect': 'error',\n 'playwright/no-conditional-in-test': 'error',\n 'playwright/no-element-handle': 'error',\n 'playwright/no-eval': 'error',\n 'playwright/no-force-option': 'error',\n 'playwright/no-nested-step': 'error',\n 'playwright/no-page-pause': 'error',\n 'playwright/no-useless-await': 'error',\n 'playwright/no-useless-not': 'error',\n 'playwright/no-wait-for-selector': 'error',\n 'playwright/no-wait-for-timeout': 'error',\n\n 'playwright/no-skipped-test': 'error',\n\n // Relax base rules for test files - each override has documented justification:\n //\n // no-empty-function: Tests often need empty callbacks for mocks/stubs:\n // const mockFn = vi.fn(() => {}); // Valid mock with no implementation\n // await expect(action).rejects.toThrow(); // Empty catch in expect wrapper\n '@typescript-eslint/no-empty-function': 'off',\n //\n // detect-non-literal-fs-filename: Tests read fixtures from known safe paths:\n // const fixture = readFileSync(join(__dirname, 'fixtures', testCase.input));\n // Test fixtures are developer-controlled, not user input.\n 'security/detect-non-literal-fs-filename': 'off',\n //\n // no-unsafe-* rules: Tests legitimately use partial mocks, fixtures, and stubs.\n '@typescript-eslint/no-unsafe-assignment': 'off',\n '@typescript-eslint/no-unsafe-member-access': 'off',\n '@typescript-eslint/no-unsafe-call': 'off',\n '@typescript-eslint/no-unsafe-argument': 'off',\n '@typescript-eslint/no-unsafe-return': 'off',\n //\n // no-nested-functions: Test organization uses nested describe/it patterns.\n 'sonarjs/no-nested-functions': 'off',\n //\n // no-null: Playwright API explicitly uses null in signatures:\n // await page.waitForFunction(() => window.loaded, null, { timeout: 5000 });\n // See: https://playwright.dev/docs/api/class-page#page-wait-for-function\n 'unicorn/no-null': 'off',\n },\n },\n];\n","/**\n * Recommended ESLint configuration for JavaScript + LLM coding agents\n *\n * This preset bundles and configures multiple ESLint plugins with\n * severity levels optimized for catching common LLM-generated code issues.\n *\n * Philosophy: LLMs ignore warnings, so rules that catch real bugs are at \"error\".\n *\n * For TypeScript projects, use `recommendedTypeScript` instead.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport pluginJsdoc from 'eslint-plugin-jsdoc';\n\nimport { basePlugins, prettierConfig } from './base.js';\n\n/**\n * JavaScript recommended config - core plugins without TypeScript\n *\n * Note: Uses any[] because ESLint plugin types are incompatible across packages.\n * Runtime validation by ESLint ensures correctness.\n */\n\nexport const recommended: any[] = [\n // All base plugins (security, promise, unicorn, etc.)\n ...basePlugins,\n\n // JSDoc - JavaScript needs docs (no type safety net)\n // Using error config - LLMs ignore warnings\n pluginJsdoc.configs['flat/recommended-error'],\n\n // Prettier must be last to disable conflicting rules\n prettierConfig,\n\n // Re-enable curly after prettier (prettier turns it off but we want braces for LLM code)\n {\n rules: {\n curly: 'error', // Force braces on if/else/for/while - LLMs write unsafe single-line blocks\n },\n },\n];\n","/**\n * Recommended ESLint configuration for Next.js + TypeScript + LLM coding agents\n *\n * Extends the React config with Next.js-specific rules:\n * - @next/eslint-plugin-next: Framework rules (Image, Link, Head, etc.)\n *\n * Philosophy: LLMs make Next.js-specific mistakes. All rules at error severity.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport nextPlugin from '@next/eslint-plugin-next';\n\nimport { recommendedTypeScriptReact } from './recommended-react.js';\n\n/**\n * Next.js-only rules for monorepo scoping\n *\n * Contains ONLY Next.js-specific ESLint rules without React rules.\n * Use with `files:` scoping in monorepos where only some packages use Next.js,\n * while React rules apply to all React packages.\n */\nexport const nextOnlyRules: any[] = [\n // Next.js plugin with core-web-vitals config (stricter)\n nextPlugin.configs['core-web-vitals'],\n\n // Escalate ALL remaining warn rules to error (LLMs ignore warnings)\n {\n name: 'safeword/nextjs-rules',\n rules: {\n '@next/next/google-font-display': 'error',\n '@next/next/google-font-preconnect': 'error',\n '@next/next/next-script-for-ga': 'error',\n '@next/next/no-async-client-component': 'error',\n '@next/next/no-before-interactive-script-outside-document': 'error',\n '@next/next/no-css-tags': 'error',\n '@next/next/no-head-element': 'error',\n '@next/next/no-img-element': 'error',\n '@next/next/no-page-custom-font': 'error',\n '@next/next/no-styled-jsx-in-document': 'error',\n '@next/next/no-title-in-document-head': 'error',\n '@next/next/no-typos': 'error',\n '@next/next/no-unwanted-polyfillio': 'error',\n },\n },\n];\n\n/**\n * Next.js + TypeScript recommended config\n *\n * Extends React config with Next.js-specific rules for catching\n * common LLM mistakes: using <img> instead of <Image>, <a> instead of <Link>.\n */\nexport const recommendedTypeScriptNext: any[] = [\n // All React + TypeScript rules\n ...recommendedTypeScriptReact,\n\n // Next.js-only rules\n ...nextOnlyRules,\n];\n","/**\n * Recommended ESLint configuration for React + TypeScript + LLM coding agents\n *\n * Extends the TypeScript config with React-specific rules:\n * - eslint-plugin-react: JSX rules (keys, duplicates, etc.)\n * - eslint-plugin-react-hooks 7.x: Hook rules + React Compiler diagnostics\n * - eslint-plugin-jsx-a11y: Accessibility rules (strict preset)\n *\n * Philosophy: LLMs make React-specific mistakes. These rules catch them.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport jsxA11y from 'eslint-plugin-jsx-a11y';\nimport reactPlugin from 'eslint-plugin-react';\nimport reactHooksPluginImport from 'eslint-plugin-react-hooks';\n\n// Type assertion - react-hooks 7.x exports configs but types don't declare it\nconst reactHooksPlugin = reactHooksPluginImport as unknown as {\n configs?: { flat?: { 'recommended-latest'?: any } };\n};\n\nimport { recommendedTypeScript } from './recommended-typescript.js';\n\n// Runtime validation - ensure react-hooks 7.x with flat config support\nconst reactHooksConfig = reactHooksPlugin.configs?.flat?.['recommended-latest'];\nif (!reactHooksConfig) {\n throw new Error(\n 'safeword requires eslint-plugin-react-hooks >= 7.0.0 with flat config support. ' +\n 'Please upgrade react-hooks: npm install eslint-plugin-react-hooks@latest',\n );\n}\n\n/**\n * React + TypeScript recommended config\n *\n * Extends TypeScript config with React-specific rules for catching\n * common LLM mistakes: missing keys, hook violations, stale closures.\n *\n * Includes React Compiler rules (v7.x) for detecting purity violations,\n * improper memoization, and other compiler-incompatible patterns.\n */\nexport const recommendedTypeScriptReact: any[] = [\n // All TypeScript rules (includes base plugins)\n ...recommendedTypeScript,\n\n // React plugin - JSX rules\n reactPlugin.configs.flat?.recommended,\n reactPlugin.configs.flat?.['jsx-runtime'], // React 17+ (no import React needed)\n\n // React Hooks + Compiler rules (v7.x flat config)\n // Using recommended-latest which includes void-use-memo\n reactHooksConfig,\n\n // Accessibility rules - strict preset (all at error level)\n jsxA11y.flatConfigs.strict,\n\n // Escalate warn rules to error + add LLM-critical rules\n {\n name: 'safeword/react-hooks-rules',\n rules: {\n // Escalate default warns to error (LLMs ignore warnings)\n 'react-hooks/exhaustive-deps': 'error', // Default: warn\n 'react-hooks/incompatible-library': 'error', // Default: warn\n 'react-hooks/unsupported-syntax': 'error', // Default: warn\n\n // LLM-critical rules NOT in recommended-latest preset\n 'react-hooks/memoized-effect-dependencies': 'error', // LLMs create unstable refs as deps\n 'react-hooks/no-deriving-state-in-effects': 'error', // LLMs derive state in useEffect\n },\n },\n\n // React rule overrides for TypeScript projects\n {\n name: 'safeword/react-rules',\n rules: {\n // Turn off rules that are redundant with TypeScript\n 'react/prop-types': 'off', // TS handles prop validation\n 'react/react-in-jsx-scope': 'off', // Not needed with React 17+\n\n // Escalate important rules to error\n 'react/jsx-key': 'error', // LLMs forget keys in map()\n 'react/jsx-no-duplicate-props': 'error', // Copy-paste bugs\n 'react/no-direct-mutation-state': 'error', // Critical React bug\n 'react/no-children-prop': 'error', // Anti-pattern\n 'react/jsx-no-target-blank': 'error', // Security - has autofix\n 'react/no-unknown-property': 'error', // class -> className, has autofix\n 'react/no-unescaped-entities': 'error', // XSS prevention\n },\n },\n];\n","/**\n * Recommended ESLint configuration for TypeScript + LLM coding agents\n *\n * Extends the base recommended config with typescript-eslint's\n * strictTypeChecked + stylisticTypeChecked presets.\n *\n * Type-checked rules are critical for LLM code - they catch:\n * - Floating promises (forgot await)\n * - Misused promises (passing promise where value expected)\n * - Unsafe any usage\n * - Incorrect async/await patterns\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport { importX } from 'eslint-plugin-import-x';\nimport { configs as tseslintConfigs } from 'typescript-eslint';\n\nimport { basePlugins, prettierConfig } from './base.js';\n\n/**\n * File patterns for TypeScript files.\n * Used for parser options and type-checked rules.\n */\nconst TS_FILES = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'];\n\n/**\n * TypeScript recommended config - all base plugins + typescript-eslint strict\n *\n * Requires: tsconfig.json in project root (or configured via languageOptions)\n *\n * Note: Uses any[] because ESLint plugin types are incompatible across packages.\n * Runtime validation by ESLint ensures correctness.\n */\n\nexport const recommendedTypeScript: any[] = [\n // All base plugins (security, promise, unicorn, etc.)\n ...basePlugins,\n\n // TypeScript-specific import config\n importX.flatConfigs.typescript,\n\n // typescript-eslint strict + stylistic (type-checked)\n ...tseslintConfigs.strictTypeChecked,\n ...tseslintConfigs.stylisticTypeChecked,\n\n // Enable projectService for type-checked rules (modern approach, auto-discovers tsconfig)\n {\n name: 'safeword/typescript-parser-options',\n files: TS_FILES,\n languageOptions: {\n parserOptions: {\n projectService: true,\n },\n },\n },\n\n // Disable type-checked rules for non-TS files (no type info available)\n // Includes JS files and .astro files (which use astro-eslint-parser)\n {\n ...tseslintConfigs.disableTypeChecked,\n name: 'safeword/disable-type-checked-for-non-ts',\n files: ['**/*.js', '**/*.mjs', '**/*.cjs', '**/*.jsx', '**/*.astro'],\n },\n\n // No JSDoc for TypeScript - types > docs\n // TypeScript signatures provide better documentation than JSDoc\n\n // TypeScript-specific rule overrides for LLM code\n // Only applies to TS files (JS files don't have type info for these rules)\n {\n name: 'safeword/typescript-rules',\n files: TS_FILES,\n rules: {\n // consistent-type-definitions: Disabled because both interface and type are valid:\n // - interface: Better error messages, extendable, declaration merging\n // - type: Union/intersection types, mapped types, template literals\n // Forcing one over the other limits expressiveness. Teams should choose per-case.\n // See: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces\n '@typescript-eslint/consistent-type-definitions': 'off',\n\n // LLMs use `any` when stuck - force them to use `unknown` instead\n '@typescript-eslint/no-explicit-any': 'error',\n\n // LLMs use truthy checks when they should be explicit\n // This catches bugs like `if (count)` when count could be 0\n '@typescript-eslint/strict-boolean-expressions': [\n 'error',\n {\n allowString: true, // Allow string checks (common pattern)\n allowNumber: false, // Disallow number checks (0 is falsy bug)\n allowNullableObject: true,\n allowNullableBoolean: true,\n allowNullableString: true,\n allowNullableNumber: false,\n allowAny: false,\n },\n ],\n\n // Underscore prefix convention for intentionally unused vars (matches TypeScript behavior)\n '@typescript-eslint/no-unused-vars': [\n 'error',\n {\n argsIgnorePattern: '^_',\n varsIgnorePattern: '^_',\n caughtErrorsIgnorePattern: '^_',\n },\n ],\n\n // Design rules not in strict+stylistic (high LLM value)\n '@typescript-eslint/consistent-type-imports': 'error', // import type { X } for types\n '@typescript-eslint/switch-exhaustiveness-check': 'error', // Missing case in union switch\n '@typescript-eslint/no-shadow': 'error', // Variable shadows outer scope\n '@typescript-eslint/require-array-sort-compare': 'error', // [].sort() needs compareFn\n '@typescript-eslint/no-unused-private-class-members': 'error', // Catch dead code in classes\n\n // Allow numbers in template literals - common for logging/debugging.\n // Integers stringify predictably; floats should use toFixed() for precision.\n '@typescript-eslint/restrict-template-expressions': [\n 'error',\n {\n allowNumber: true,\n allowBoolean: true,\n allowNullish: false, // Avoid \"undefined\" or \"null\" in strings\n allowRegExp: false,\n },\n ],\n },\n },\n\n // Prettier must be last to disable conflicting rules\n prettierConfig,\n\n // Re-enable curly after prettier (prettier turns it off but we want braces for LLM code)\n {\n name: 'safeword/post-prettier',\n rules: {\n curly: 'error', // Force braces on if/else/for/while - LLMs write unsafe single-line blocks\n },\n },\n];\n","/**\n * ESLint configuration for Storybook stories\n *\n * Uses official flat/recommended as base, then:\n * - Upgrades all warn → error (LLMs ignore warnings)\n * - Adds strict rules not in recommended\n *\n * @see https://github.com/storybookjs/eslint-plugin-storybook\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport storybookPlugin from 'eslint-plugin-storybook';\n\n/**\n * Storybook story linting config\n *\n * Based on flat/recommended with stricter settings for LLM code generation.\n */\nexport const storybookConfig: any[] = [\n // Use official flat/recommended as base (includes plugin setup + file patterns)\n ...storybookPlugin.configs['flat/recommended'],\n\n // Override warnings to errors + add strict rules\n {\n name: 'safeword/storybook-strict',\n files: ['**/*.stories.{ts,tsx,js,jsx,mjs,cjs}', '**/*.story.{ts,tsx,js,jsx,mjs,cjs}'],\n rules: {\n // Upgrade warn → error (LLMs ignore warnings)\n 'storybook/hierarchy-separator': 'error',\n 'storybook/no-redundant-story-name': 'error',\n 'storybook/prefer-pascal-case': 'error',\n\n // Strict rules not in recommended (useful for LLMs)\n 'storybook/csf-component': 'error', // component property should be set\n 'storybook/no-stories-of': 'error', // storiesOf is deprecated\n 'storybook/meta-inline-properties': 'error', // Meta should only have inline properties\n },\n },\n];\n","/**\n * ESLint configuration for Tailwind CSS projects\n *\n * Uses eslint-plugin-better-tailwindcss for native Tailwind v4 support.\n * All rules enabled at error level (LLMs ignore warnings).\n *\n * Includes 11 rules:\n * - Correctness: no-conflicting-classes, no-unregistered-classes, no-restricted-classes\n * - Stylistic: enforce-consistent-class-order, enforce-shorthand-classes, no-duplicate-classes,\n * no-deprecated-classes, enforce-consistent-line-wrapping, no-unnecessary-whitespace,\n * enforce-consistent-variable-syntax, enforce-consistent-important-position\n *\n * @see https://github.com/schoero/eslint-plugin-better-tailwindcss\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport eslintPluginBetterTailwindcss from 'eslint-plugin-better-tailwindcss';\n\n/** File patterns for Tailwind rules - targets files containing Tailwind classes */\nexport const TAILWIND_FILES = ['**/*.{jsx,tsx,astro,html}'];\n\nexport const tailwindConfig: any[] = [\n {\n name: 'safeword/tailwind',\n files: TAILWIND_FILES,\n plugins: {\n 'better-tailwindcss': eslintPluginBetterTailwindcss,\n },\n rules: {\n // Correctness rules - catch LLM mistakes\n 'better-tailwindcss/no-conflicting-classes': 'error',\n 'better-tailwindcss/no-unregistered-classes': 'error',\n 'better-tailwindcss/no-restricted-classes': 'error', // no-op by default, configurable\n\n // Stylistic rules - enforce consistency\n 'better-tailwindcss/enforce-consistent-class-order': 'error',\n 'better-tailwindcss/enforce-consistent-line-wrapping': 'error',\n 'better-tailwindcss/enforce-consistent-variable-syntax': 'error',\n 'better-tailwindcss/enforce-consistent-important-position': 'error',\n 'better-tailwindcss/enforce-shorthand-classes': 'error',\n 'better-tailwindcss/no-duplicate-classes': 'error',\n 'better-tailwindcss/no-deprecated-classes': 'error',\n 'better-tailwindcss/no-unnecessary-whitespace': 'error',\n },\n },\n];\n","/**\n * ESLint configuration for TanStack Query\n *\n * Enforces best practices for TanStack Query (React Query).\n * All 7 rules at error severity - LLMs have no valid reason to violate these.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport tanstackQueryPlugin from '@tanstack/eslint-plugin-query';\n\n/**\n * TanStack Query linting config\n *\n * All rules at error severity:\n * - exhaustive-deps: Missing query key deps → stale cached data\n * - stable-query-client: Client in component → infinite re-render loop\n * - no-void-query-fn: No return → undefined cached\n * - no-rest-destructuring: ...rest loses reactivity\n * - no-unstable-deps: New function each render → unnecessary refetches\n * - infinite-query-property-order: Wrong order → TypeScript can't infer types\n * - mutation-property-order: Wrong order → TypeScript can't infer types\n */\nexport const tanstackQueryConfig: any[] = [\n {\n name: 'safeword/tanstack-query',\n plugins: {\n '@tanstack/query': tanstackQueryPlugin,\n },\n rules: {\n '@tanstack/query/exhaustive-deps': 'error',\n '@tanstack/query/stable-query-client': 'error',\n '@tanstack/query/no-void-query-fn': 'error',\n '@tanstack/query/no-rest-destructuring': 'error',\n '@tanstack/query/no-unstable-deps': 'error',\n '@tanstack/query/infinite-query-property-order': 'error',\n '@tanstack/query/mutation-property-order': 'error',\n },\n },\n];\n","/**\n * ESLint configuration for Turborepo projects\n *\n * Ensures environment variables used in code are declared in turbo.json\n * for proper cache invalidation.\n *\n * @see https://turbo.build/repo/docs/reference/eslint-plugin-turbo\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport turboPlugin from 'eslint-plugin-turbo';\n\n/**\n * Turborepo env var validation config\n *\n * Uses official flat/recommended preset (already at error severity).\n * Catches undeclared env vars that would break Turborepo caching.\n */\nexport const turboConfig: any[] = [turboPlugin.configs?.['flat/recommended']].filter(Boolean);\n","/**\n * ESLint configuration for Vitest tests\n *\n * Applies to test files: *.test.ts, *.spec.ts\n * Enforces test best practices for LLM-generated tests.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport vitestPlugin from '@vitest/eslint-plugin';\n\n/**\n * Vitest test linting config\n *\n * Includes recommended rules plus no-focused-tests.\n * All rules at error severity.\n */\nexport const vitestConfig: any[] = [\n {\n name: 'safeword/vitest',\n files: ['**/*.test.{ts,tsx,js,jsx}', '**/*.spec.{ts,tsx,js,jsx}'],\n plugins: {\n vitest: vitestPlugin,\n },\n rules: {\n // Recommended rules (all at error)\n // Allow expect* helper functions (e.g., expectErrorSeverity) as assertion functions\n 'vitest/expect-expect': ['error', { assertFunctionNames: ['expect', 'expect*'] }],\n 'vitest/no-identical-title': 'error',\n 'vitest/no-commented-out-tests': 'error',\n 'vitest/valid-title': 'error',\n 'vitest/valid-expect': ['error', { maxArgs: 2 }], // Allow custom message: expect(value, 'message')\n 'vitest/valid-describe-callback': 'error',\n 'vitest/require-local-test-context-for-concurrent-snapshots': 'error',\n 'vitest/no-import-node-test': 'error',\n\n // Additional strict rules\n 'vitest/no-focused-tests': 'error', // No .only() in CI\n 'vitest/max-nested-describe': ['error', { max: 5 }], // Limit describe nesting depth\n\n // Relax base rules for test files - each override has documented justification:\n //\n // no-empty-function: Tests often need empty callbacks for mocks/stubs:\n // const mockFn = vi.fn(() => {}); // Valid mock with no implementation\n // await expect(action).rejects.toThrow(); // Empty catch in expect wrapper\n '@typescript-eslint/no-empty-function': 'off',\n //\n // detect-non-literal-fs-filename: Tests read fixtures from known safe paths:\n // const fixture = readFileSync(join(__dirname, 'fixtures', testCase.input));\n // Test fixtures are developer-controlled, not user input.\n 'security/detect-non-literal-fs-filename': 'off',\n //\n // no-unsafe-* rules: Tests legitimately use partial mocks, fixtures, and stubs\n // that trigger these rules. The typescript-eslint team acknowledges this:\n // \"If your project frequently stubs objects in test files, consider disabling.\"\n // See: https://typescript-eslint.io/rules/no-unsafe-member-access/\n '@typescript-eslint/no-unsafe-assignment': 'off',\n '@typescript-eslint/no-unsafe-member-access': 'off',\n '@typescript-eslint/no-unsafe-call': 'off',\n '@typescript-eslint/no-unsafe-argument': 'off',\n '@typescript-eslint/no-unsafe-return': 'off',\n //\n // no-nested-functions: describe/it nesting is standard test organization:\n // describe(\"Foo\", () => { describe(\"bar\", () => { it(\"works\", () => {}) }) })\n // This triggers at level 4+, which is normal for BDD-style tests.\n 'sonarjs/no-nested-functions': 'off',\n //\n // Keep max-nested-callbacks at reasonable threshold for tests.\n // Default is 10; we use 6 to catch excessive nesting early while allowing\n // typical patterns like: describe → it → array.filter → callback.\n 'max-nested-callbacks': ['error', { max: 6 }],\n },\n },\n];\n","/**\n * TypeScript Preset\n *\n * ESLint configs, rules, and detection for TypeScript/JavaScript projects.\n * This is the main entry point for the TypeScript language preset.\n *\n * Usage in user's eslint.config.mjs:\n * import { defineConfig } from 'eslint/config';\n * import safeword from 'safeword/eslint';\n * export default defineConfig([\n * ...safeword.configs.recommendedTypeScript,\n * ]);\n *\n * Or with multiple configs:\n * export default defineConfig([\n * ...safeword.configs.recommendedTypeScript,\n * ...safeword.configs.vitest,\n * safeword.configs.cli,\n * ]);\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any -- ESLint config types are incompatible across plugin packages */\n\nimport type { Rule } from 'eslint';\n\nimport { VERSION } from '../../version.js';\nimport { detect } from './detect.js';\nimport { astroConfig } from './eslint-configs/astro.js';\nimport { prettierConfig } from './eslint-configs/base.js';\nimport { cliConfig } from './eslint-configs/overrides-cli.js';\nimport { relaxedTypesConfig } from './eslint-configs/overrides-relaxed-types.js';\nimport { playwrightConfig } from './eslint-configs/playwright.js';\nimport { recommended } from './eslint-configs/recommended.js';\nimport { nextOnlyRules, recommendedTypeScriptNext } from './eslint-configs/recommended-nextjs.js';\nimport { recommendedTypeScriptReact } from './eslint-configs/recommended-react.js';\nimport { recommendedTypeScript } from './eslint-configs/recommended-typescript.js';\nimport { storybookConfig } from './eslint-configs/storybook.js';\nimport { tailwindConfig } from './eslint-configs/tailwind.js';\nimport { tanstackQueryConfig } from './eslint-configs/tanstack-query.js';\nimport { turboConfig } from './eslint-configs/turbo.js';\nimport { vitestConfig } from './eslint-configs/vitest.js';\nimport { rules } from './eslint-rules/index.js';\n\ninterface SafewordEslint {\n meta: {\n name: string;\n version: string;\n /** Namespace for defineConfig string-extends resolution (e.g. `extends: [\"safeword/cli\"]`) */\n namespace: string;\n };\n configs: {\n recommended: any[];\n recommendedTypeScript: any[];\n recommendedTypeScriptReact: any[];\n recommendedTypeScriptNext: any[];\n /** Next.js-only rules for monorepo file scoping */\n nextOnlyRules: any[];\n astro: any[];\n tailwind: any[];\n tanstackQuery: any[];\n vitest: any[];\n playwright: any[];\n storybook: any[];\n turbo: any[];\n /** Security rules that are false positives for CLI tools, build tools, and scripts */\n cli: any;\n /** Strict TypeScript rules that conflict with untyped external data (JSON, YAML, APIs) */\n relaxedTypes: any;\n };\n detect: typeof detect;\n rules: Record<string, Rule.RuleModule>;\n /** eslint-config-prettier, bundled for convenience */\n prettierConfig: any;\n}\n\n/**\n * ESLint plugin structure for TypeScript preset.\n * Can be used directly as an ESLint plugin or via safeword.eslint.\n */\nexport const eslintPlugin: SafewordEslint = {\n meta: {\n name: 'safeword',\n version: VERSION,\n namespace: 'safeword',\n },\n configs: {\n recommended,\n recommendedTypeScript,\n recommendedTypeScriptReact,\n recommendedTypeScriptNext,\n nextOnlyRules,\n astro: astroConfig,\n tailwind: tailwindConfig,\n tanstackQuery: tanstackQueryConfig,\n vitest: vitestConfig,\n playwright: playwrightConfig,\n storybook: storybookConfig,\n turbo: turboConfig,\n cli: cliConfig,\n relaxedTypes: relaxedTypesConfig,\n },\n detect,\n rules,\n prettierConfig,\n};\n\n// Re-export configs for direct access\nexport { detect } from './detect.js';\nexport { astroConfig } from './eslint-configs/astro.js';\nexport { prettierConfig } from './eslint-configs/base.js';\nexport { cliConfig } from './eslint-configs/overrides-cli.js';\nexport { relaxedTypesConfig } from './eslint-configs/overrides-relaxed-types.js';\nexport { playwrightConfig } from './eslint-configs/playwright.js';\nexport { recommended } from './eslint-configs/recommended.js';\nexport { nextOnlyRules, recommendedTypeScriptNext } from './eslint-configs/recommended-nextjs.js';\nexport { recommendedTypeScriptReact } from './eslint-configs/recommended-react.js';\nexport { recommendedTypeScript } from './eslint-configs/recommended-typescript.js';\nexport { storybookConfig } from './eslint-configs/storybook.js';\nexport { tailwindConfig } from './eslint-configs/tailwind.js';\nexport { tanstackQueryConfig } from './eslint-configs/tanstack-query.js';\nexport { turboConfig } from './eslint-configs/turbo.js';\nexport { vitestConfig } from './eslint-configs/vitest.js';\nexport { rules } from './eslint-rules/index.js';\n\n// Default export for `import safeword from \"safeword/eslint\"`\nexport default eslintPlugin;\n"],"mappings":";;;;;;;;AASA,OAAO,iBAAiB;AAcjB,IAAM,cAAqB;AAAA;AAAA,EAEhC,GAAG,YAAY,QAAQ,kBAAkB;AAAA;AAAA,EAGzC,GAAG,YAAY,QAAQ,sBAAsB;AAAA;AAAA,EAG7C;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA;AAAA,MAEL,+BAA+B;AAAA;AAAA,MAG/B,kCAAkC;AAAA;AAAA,MAGlC,oCAAoC;AAAA,IACtC;AAAA,EACF;AACF;;;ACrCA,OAAO,QAAQ;AACf,OAAO,oBAAoB;AAC3B,SAAS,sCAAsC;AAC/C,SAAS,eAAe;AACxB,OAAO,mBAAmB;AAC1B,SAAS,WAAW,qBAAqB;AACzC,OAAO,oBAAoB;AAC3B,OAAO,sBAAsB;AAC7B,SAAS,WAAW,oBAAoB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,SAAS,EAAE,qBAAqB,CAAC,UAAU,SAAS,EAAE,CAAC;AAAA,MAChF,6BAA6B;AAAA,MAC7B,iCAAiC;AAAA,MACjC,sBAAsB;AAAA,MACtB,uBAAuB,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC;AAAA;AAAA,MAC/C,kCAAkC;AAAA,MAClC,8DAA8D;AAAA,MAC9D,8BAA8B;AAAA;AAAA,MAG9B,2BAA2B;AAAA;AAAA,MAC3B,8BAA8B,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOlD,wCAAwC;AAAA;AAAA;AAAA;AAAA;AAAA,MAKxC,2CAA2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAM3C,2CAA2C;AAAA,MAC3C,8CAA8C;AAAA,MAC9C,qCAAqC;AAAA,MACrC,yCAAyC;AAAA,MACzC,uCAAuC;AAAA;AAAA;AAAA;AAAA;AAAA,MAKvC,+BAA+B;AAAA;AAAA;AAAA;AAAA;AAAA,MAK/B,wBAAwB,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;;;ACMO,IAAM,eAA+B;AAAA,EAC1C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AAAA,EACA,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,eAAe;AAAA,IACf,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,OAAO;AAAA,IACP,KAAK;AAAA,IACL,cAAc;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAAC;AACF;AAqBA,IAAO,qBAAQ;","names":["rule","rule","default","default","importX","importX","default","default"]}
@@ -3,8 +3,10 @@ import { createRequire } from "module";
3
3
  var require2 = createRequire(import.meta.url);
4
4
  var pkg = require2("../package.json");
5
5
  var VERSION = pkg.version;
6
+ var SAFEWORD_PEER_DEPENDENCIES = pkg.peerDependencies ?? {};
6
7
 
7
8
  export {
8
- VERSION
9
+ VERSION,
10
+ SAFEWORD_PEER_DEPENDENCIES
9
11
  };
10
- //# sourceMappingURL=chunk-ORQHKDT2.js.map
12
+ //# sourceMappingURL=chunk-HSC7TELY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["import { createRequire } from 'node:module';\n\nconst require = createRequire(import.meta.url);\n// The relative path is intentional and must stay at one `..` — version.ts is at\n// src/ (depth 1 from packages/cli/), and tsup bundles it to dist/ (also depth 1),\n// so `../package.json` resolves correctly in both contexts. Helpers nested under\n// src/utils/ cannot read package.json directly without breaking once bundled —\n// they should import the metadata from here instead.\nconst pkg = require('../package.json') as {\n version: string;\n peerDependencies?: Record<string, string>;\n};\n\nexport const VERSION = pkg.version;\nexport const SAFEWORD_PEER_DEPENDENCIES = pkg.peerDependencies ?? {};\n"],"mappings":";AAAA,SAAS,qBAAqB;AAE9B,IAAMA,WAAU,cAAc,YAAY,GAAG;AAM7C,IAAM,MAAMA,SAAQ,iBAAiB;AAK9B,IAAM,UAAU,IAAI;AACpB,IAAM,6BAA6B,IAAI,oBAAoB,CAAC;","names":["require"]}
@@ -0,0 +1,76 @@
1
+ import {
2
+ LANGUAGE_PACKS,
3
+ addInstalledPack,
4
+ isGitRepo,
5
+ isPackInstalled
6
+ } from "./chunk-UOUUMDSB.js";
7
+ import {
8
+ SAFEWORD_PEER_DEPENDENCIES
9
+ } from "./chunk-HSC7TELY.js";
10
+ import {
11
+ exists,
12
+ readJson
13
+ } from "./chunk-QARISSCT.js";
14
+
15
+ // src/packs/install.ts
16
+ function installPack(packId, cwd) {
17
+ if (isPackInstalled(cwd, packId)) {
18
+ return;
19
+ }
20
+ const pack = LANGUAGE_PACKS[packId];
21
+ if (!pack) {
22
+ throw new Error(`Unknown pack: ${packId}`);
23
+ }
24
+ pack.setup(cwd, { isGitRepo: isGitRepo(cwd) });
25
+ addInstalledPack(cwd, packId);
26
+ }
27
+
28
+ // src/utils/eslint-peer-check.ts
29
+ import nodePath from "path";
30
+ function getSupportedEslintMajors() {
31
+ const range = SAFEWORD_PEER_DEPENDENCIES.eslint;
32
+ if (!range) return [];
33
+ return extractMajors(range);
34
+ }
35
+ function extractMajorFromComparator(comparator) {
36
+ const cleaned = comparator.trim().replace(/^[\^~>=<]+/, "");
37
+ const match = /^(\d+)\./.exec(cleaned) ?? /^(\d+)(?:\.x|\.\*|$)/.exec(cleaned);
38
+ const majorString = match?.[1];
39
+ if (majorString === void 0) return void 0;
40
+ const major = Number.parseInt(majorString, 10);
41
+ return Number.isNaN(major) ? void 0 : major;
42
+ }
43
+ function extractMajors(range) {
44
+ const majors = /* @__PURE__ */ new Set();
45
+ for (const part of range.split("||")) {
46
+ const major = extractMajorFromComparator(part);
47
+ if (major !== void 0) majors.add(major);
48
+ }
49
+ return [...majors].toSorted((a, b) => a - b);
50
+ }
51
+ function getEslintPeerMismatchWarning(cwd) {
52
+ const packageJsonPath = nodePath.join(cwd, "package.json");
53
+ if (!exists(packageJsonPath)) return void 0;
54
+ const pkg = readJson(packageJsonPath);
55
+ if (!pkg) return void 0;
56
+ const declared = pkg.dependencies?.eslint ?? pkg.devDependencies?.eslint;
57
+ if (!declared) return void 0;
58
+ const installedMajor = extractMajorFromComparator(declared);
59
+ if (installedMajor === void 0) return void 0;
60
+ const supportedMajors = getSupportedEslintMajors();
61
+ if (supportedMajors.length === 0) return void 0;
62
+ if (supportedMajors.includes(installedMajor)) return void 0;
63
+ const supportedDisplay = supportedMajors.map((major) => `${major}.x`).join(" or ");
64
+ return [
65
+ `Project declares eslint@${declared} (major ${installedMajor}), but safeword`,
66
+ `supports eslint ${supportedDisplay}. Safeword's bundled plugins are tested`,
67
+ `against the supported range; lint may crash on other majors (e.g. plugin`,
68
+ `transitives that reference removed ESLint APIs).`
69
+ ].join("\n");
70
+ }
71
+
72
+ export {
73
+ installPack,
74
+ getEslintPeerMismatchWarning
75
+ };
76
+ //# sourceMappingURL=chunk-RE5O6MEQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/packs/install.ts","../src/utils/eslint-peer-check.ts"],"sourcesContent":["/**\n * Pack Installation\n *\n * Install language packs and update config.\n */\n\nimport { isGitRepo } from '../utils/git.js';\nimport { addInstalledPack, isPackInstalled } from './config.js';\nimport { LANGUAGE_PACKS } from './registry.js';\n\n/**\n * Install a language pack.\n *\n * Runs the pack's setup function and updates config.json.\n * Idempotent - does nothing if pack is already installed.\n *\n * @param packId - Pack ID to install (e.g., 'python')\n * @param cwd - Project root directory\n * @throws Error if pack ID is unknown\n */\nexport function installPack(packId: string, cwd: string): void {\n // Idempotent - skip if already installed\n if (isPackInstalled(cwd, packId)) {\n return;\n }\n\n const pack = LANGUAGE_PACKS[packId];\n if (!pack) {\n throw new Error(`Unknown pack: ${packId}`);\n }\n\n pack.setup(cwd, { isGitRepo: isGitRepo(cwd) });\n addInstalledPack(cwd, packId);\n}\n","/**\n * ESLint peer-dep mismatch detection for safeword install/upgrade flows.\n *\n * Reads the project's declared `eslint` version (dependencies or devDependencies)\n * and compares its major against safeword's own peerDependencies.eslint range.\n * Returns a human-readable warning when the customer's major is outside the\n * supported set; returns undefined otherwise (including when nothing is\n * declared or the range can't be parsed — only positively-mismatched majors\n * warn).\n *\n * Background: safeword's ESLint preset bundles plugins whose internals can\n * break on ESLint majors safeword hasn't tested against. The vitest plugin's\n * transitive @typescript-eslint/utils@7.x crashed on ESLint 10 LegacyESLint\n * removal; that motivated this guard so the next collision surfaces at\n * install time rather than the first lint run.\n */\n\nimport nodePath from 'node:path';\n\nimport { SAFEWORD_PEER_DEPENDENCIES } from '../version.js';\nimport { exists, readJson } from './fs.js';\n\ninterface ProjectPackageJson {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n}\n\n/**\n * Pull the supported eslint major versions from safeword's own peerDependencies.\n * `^9.22.0` → [9]; `^9.22.0 || ^10.0.0` → [9, 10].\n *\n * Reads from version.ts rather than calling require() locally — version.ts sits\n * at src/ depth (same as the bundled dist/) so its `require('../package.json')`\n * resolves correctly in both contexts. A direct require() here would resolve\n * `../../package.json` to a nonexistent path post-bundling.\n */\nfunction getSupportedEslintMajors(): number[] {\n const range = SAFEWORD_PEER_DEPENDENCIES.eslint;\n if (!range) return [];\n return extractMajors(range);\n}\n\n/**\n * Extract the leading numeric major from a single version comparator\n * (e.g. `^9.22.0`, `>=9.0.0`, `9.x`, `9.0.0`). Returns undefined for ranges\n * that can't be coerced (workspace:*, file:, git+, *, latest).\n */\nfunction extractMajorFromComparator(comparator: string): number | undefined {\n const cleaned = comparator.trim().replace(/^[\\^~>=<]+/, '');\n const match = /^(\\d+)\\./.exec(cleaned) ?? /^(\\d+)(?:\\.x|\\.\\*|$)/.exec(cleaned);\n const majorString = match?.[1];\n if (majorString === undefined) return undefined;\n const major = Number.parseInt(majorString, 10);\n return Number.isNaN(major) ? undefined : major;\n}\n\n/**\n * Parse a possibly-disjunctive range (`^9.22.0 || ^10.0.0`) into the set of\n * majors it covers. Comparators that don't yield a major are dropped.\n */\nfunction extractMajors(range: string): number[] {\n const majors = new Set<number>();\n for (const part of range.split('||')) {\n const major = extractMajorFromComparator(part);\n if (major !== undefined) majors.add(major);\n }\n return [...majors].toSorted((a, b) => a - b);\n}\n\n/**\n * Returns a warning string when the project's declared eslint major is\n * outside safeword's supported peer range; undefined otherwise.\n */\nexport function getEslintPeerMismatchWarning(cwd: string): string | undefined {\n const packageJsonPath = nodePath.join(cwd, 'package.json');\n if (!exists(packageJsonPath)) return undefined;\n\n const pkg = readJson(packageJsonPath) as ProjectPackageJson | undefined;\n if (!pkg) return undefined;\n\n const declared = pkg.dependencies?.eslint ?? pkg.devDependencies?.eslint;\n if (!declared) return undefined;\n\n const installedMajor = extractMajorFromComparator(declared);\n if (installedMajor === undefined) return undefined;\n\n const supportedMajors = getSupportedEslintMajors();\n if (supportedMajors.length === 0) return undefined;\n if (supportedMajors.includes(installedMajor)) return undefined;\n\n const supportedDisplay = supportedMajors.map(major => `${major}.x`).join(' or ');\n return [\n `Project declares eslint@${declared} (major ${installedMajor}), but safeword`,\n `supports eslint ${supportedDisplay}. Safeword's bundled plugins are tested`,\n `against the supported range; lint may crash on other majors (e.g. plugin`,\n `transitives that reference removed ESLint APIs).`,\n ].join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoBO,SAAS,YAAY,QAAgB,KAAmB;AAE7D,MAAI,gBAAgB,KAAK,MAAM,GAAG;AAChC;AAAA,EACF;AAEA,QAAM,OAAO,eAAe,MAAM;AAClC,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,iBAAiB,MAAM,EAAE;AAAA,EAC3C;AAEA,OAAK,MAAM,KAAK,EAAE,WAAW,UAAU,GAAG,EAAE,CAAC;AAC7C,mBAAiB,KAAK,MAAM;AAC9B;;;AChBA,OAAO,cAAc;AAmBrB,SAAS,2BAAqC;AAC5C,QAAM,QAAQ,2BAA2B;AACzC,MAAI,CAAC,MAAO,QAAO,CAAC;AACpB,SAAO,cAAc,KAAK;AAC5B;AAOA,SAAS,2BAA2B,YAAwC;AAC1E,QAAM,UAAU,WAAW,KAAK,EAAE,QAAQ,cAAc,EAAE;AAC1D,QAAM,QAAQ,WAAW,KAAK,OAAO,KAAK,uBAAuB,KAAK,OAAO;AAC7E,QAAM,cAAc,QAAQ,CAAC;AAC7B,MAAI,gBAAgB,OAAW,QAAO;AACtC,QAAM,QAAQ,OAAO,SAAS,aAAa,EAAE;AAC7C,SAAO,OAAO,MAAM,KAAK,IAAI,SAAY;AAC3C;AAMA,SAAS,cAAc,OAAyB;AAC9C,QAAM,SAAS,oBAAI,IAAY;AAC/B,aAAW,QAAQ,MAAM,MAAM,IAAI,GAAG;AACpC,UAAM,QAAQ,2BAA2B,IAAI;AAC7C,QAAI,UAAU,OAAW,QAAO,IAAI,KAAK;AAAA,EAC3C;AACA,SAAO,CAAC,GAAG,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,IAAI,CAAC;AAC7C;AAMO,SAAS,6BAA6B,KAAiC;AAC5E,QAAM,kBAAkB,SAAS,KAAK,KAAK,cAAc;AACzD,MAAI,CAAC,OAAO,eAAe,EAAG,QAAO;AAErC,QAAM,MAAM,SAAS,eAAe;AACpC,MAAI,CAAC,IAAK,QAAO;AAEjB,QAAM,WAAW,IAAI,cAAc,UAAU,IAAI,iBAAiB;AAClE,MAAI,CAAC,SAAU,QAAO;AAEtB,QAAM,iBAAiB,2BAA2B,QAAQ;AAC1D,MAAI,mBAAmB,OAAW,QAAO;AAEzC,QAAM,kBAAkB,yBAAyB;AACjD,MAAI,gBAAgB,WAAW,EAAG,QAAO;AACzC,MAAI,gBAAgB,SAAS,cAAc,EAAG,QAAO;AAErD,QAAM,mBAAmB,gBAAgB,IAAI,WAAS,GAAG,KAAK,IAAI,EAAE,KAAK,MAAM;AAC/E,SAAO;AAAA,IACL,2BAA2B,QAAQ,WAAW,cAAc;AAAA,IAC5D,mBAAmB,gBAAgB;AAAA,IACnC;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACb;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-YVZL7WO5.js";
4
4
  import {
5
5
  VERSION
6
- } from "./chunk-ORQHKDT2.js";
6
+ } from "./chunk-HSC7TELY.js";
7
7
  import {
8
8
  ensureDirectory,
9
9
  exists,
@@ -2448,9 +2448,10 @@ var SAFEWORD_SCHEMA = {
2448
2448
  // BDD skill split into phase files (v0.16.0)
2449
2449
  ".cursor/rules/safeword-bdd-orchestrating.mdc",
2450
2450
  ".safeword/commands/tdd.md",
2451
- // Brainstorming skill removed - never used, BDD discovery phase covers this (v0.16.0)
2451
+ // Brainstorming skill: old safeword-* skill removed (v0.16.0); cursor rule was
2452
+ // re-introduced under same name (PR #103) for the new short-name brainstorm skill,
2453
+ // so .cursor/rules/safeword-brainstorming.mdc is no longer deprecated.
2452
2454
  ".claude/skills/safeword-brainstorming/SKILL.md",
2453
- ".cursor/rules/safeword-brainstorming.mdc",
2454
2455
  // Writing-plans skill removed - redundant with BDD decomposition + Claude Code native plan mode (v0.16.0)
2455
2456
  ".claude/skills/safeword-writing-plans/SKILL.md",
2456
2457
  ".cursor/rules/safeword-writing-plans.mdc",
@@ -2505,8 +2506,7 @@ var SAFEWORD_SCHEMA = {
2505
2506
  "eslint-plugin-react-hooks",
2506
2507
  "eslint-plugin-jsx-a11y",
2507
2508
  "@next/eslint-plugin-next",
2508
- "eslint-plugin-astro",
2509
- "@vitest/eslint-plugin"
2509
+ "eslint-plugin-astro"
2510
2510
  ],
2511
2511
  // Directories to delete on upgrade (no longer managed by safeword)
2512
2512
  deprecatedDirs: [
@@ -2944,6 +2944,8 @@ var PYPROJECT_TOML = "pyproject.toml";
2944
2944
  var CLIPPY_CONFIG_FILES = ["clippy.toml", ".clippy.toml"];
2945
2945
  var RUSTFMT_CONFIG_FILES = ["rustfmt.toml", ".rustfmt.toml"];
2946
2946
  var ESLINT_CONFIG_FILES = [
2947
+ "eslint.config.ts",
2948
+ "eslint.config.mts",
2947
2949
  "eslint.config.mjs",
2948
2950
  "eslint.config.js",
2949
2951
  "eslint.config.cjs",
@@ -3131,4 +3133,4 @@ export {
3131
3133
  detectLanguages2,
3132
3134
  createProjectContext
3133
3135
  };
3134
- //# sourceMappingURL=chunk-UPAH2FHH.js.map
3136
+ //# sourceMappingURL=chunk-UOUUMDSB.js.map