safeword 0.15.10 → 0.15.11
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.
- package/dist/{check-KVWOWINW.js → check-CUCQRUXT.js} +4 -4
- package/dist/{chunk-R6ZGEH4J.js → chunk-NXSSFAFS.js} +36 -3
- package/dist/chunk-NXSSFAFS.js.map +1 -0
- package/dist/{chunk-VWOO5PJN.js → chunk-PMYWVDOF.js} +5 -1
- package/dist/chunk-PMYWVDOF.js.map +1 -0
- package/dist/{chunk-CBJLUXZ4.js → chunk-SO45XRNO.js} +72 -42
- package/dist/chunk-SO45XRNO.js.map +1 -0
- package/dist/{chunk-UIURPBCD.js → chunk-UCZB27KH.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/{diff-WEDHTHFK.js → diff-MF42ROSX.js} +3 -3
- package/dist/index.js +2 -2
- package/dist/presets/typescript/index.d.ts +40 -1
- package/dist/presets/typescript/index.js +6 -2
- package/dist/{reset-GG5AST3L.js → reset-GOAEEMD6.js} +3 -3
- package/dist/{setup-CM7WY4GS.js → setup-TISRKM2F.js} +4 -4
- package/dist/{upgrade-JKAXT46Q.js → upgrade-MI34U4M6.js} +4 -4
- package/package.json +3 -3
- package/templates/.jscpd.json +1 -1
- package/templates/guides/cli-reference.md +16 -14
- package/dist/chunk-CBJLUXZ4.js.map +0 -1
- package/dist/chunk-R6ZGEH4J.js.map +0 -1
- package/dist/chunk-VWOO5PJN.js.map +0 -1
- /package/dist/{check-KVWOWINW.js.map → check-CUCQRUXT.js.map} +0 -0
- /package/dist/{chunk-UIURPBCD.js.map → chunk-UCZB27KH.js.map} +0 -0
- /package/dist/{diff-WEDHTHFK.js.map → diff-MF42ROSX.js.map} +0 -0
- /package/dist/{reset-GG5AST3L.js.map → reset-GOAEEMD6.js.map} +0 -0
- /package/dist/{setup-CM7WY4GS.js.map → setup-TISRKM2F.js.map} +0 -0
- /package/dist/{upgrade-JKAXT46Q.js.map → upgrade-MI34U4M6.js.map} +0 -0
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-FJYRWU2V.js";
|
|
4
4
|
import {
|
|
5
5
|
getMissingPacks
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UCZB27KH.js";
|
|
7
7
|
import {
|
|
8
8
|
SAFEWORD_SCHEMA,
|
|
9
9
|
createProjectContext,
|
|
10
10
|
reconcile
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-SO45XRNO.js";
|
|
12
|
+
import "./chunk-PMYWVDOF.js";
|
|
13
13
|
import {
|
|
14
14
|
VERSION
|
|
15
15
|
} from "./chunk-ORQHKDT2.js";
|
|
@@ -189,4 +189,4 @@ async function check(options) {
|
|
|
189
189
|
export {
|
|
190
190
|
check
|
|
191
191
|
};
|
|
192
|
-
//# sourceMappingURL=check-
|
|
192
|
+
//# sourceMappingURL=check-CUCQRUXT.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detect
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PMYWVDOF.js";
|
|
4
4
|
import {
|
|
5
5
|
VERSION
|
|
6
6
|
} from "./chunk-ORQHKDT2.js";
|
|
@@ -824,6 +824,31 @@ var recommendedTypeScriptNext = [
|
|
|
824
824
|
...nextOnlyRules
|
|
825
825
|
];
|
|
826
826
|
|
|
827
|
+
// src/presets/typescript/eslint-configs/storybook.ts
|
|
828
|
+
import storybookPlugin from "eslint-plugin-storybook";
|
|
829
|
+
var storybookConfig = [
|
|
830
|
+
// Use official flat/recommended as base (includes plugin setup + file patterns)
|
|
831
|
+
...storybookPlugin.configs["flat/recommended"],
|
|
832
|
+
// Override warnings to errors + add strict rules
|
|
833
|
+
{
|
|
834
|
+
name: "safeword/storybook-strict",
|
|
835
|
+
files: ["**/*.stories.{ts,tsx,js,jsx,mjs,cjs}", "**/*.story.{ts,tsx,js,jsx,mjs,cjs}"],
|
|
836
|
+
rules: {
|
|
837
|
+
// Upgrade warn → error (LLMs ignore warnings)
|
|
838
|
+
"storybook/hierarchy-separator": "error",
|
|
839
|
+
"storybook/no-redundant-story-name": "error",
|
|
840
|
+
"storybook/prefer-pascal-case": "error",
|
|
841
|
+
// Strict rules not in recommended (useful for LLMs)
|
|
842
|
+
"storybook/csf-component": "error",
|
|
843
|
+
// component property should be set
|
|
844
|
+
"storybook/no-stories-of": "error",
|
|
845
|
+
// storiesOf is deprecated
|
|
846
|
+
"storybook/meta-inline-properties": "error"
|
|
847
|
+
// Meta should only have inline properties
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
];
|
|
851
|
+
|
|
827
852
|
// src/presets/typescript/eslint-configs/tailwind.ts
|
|
828
853
|
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
829
854
|
var TAILWIND_FILES = ["**/*.{jsx,tsx,astro,html}"];
|
|
@@ -873,6 +898,10 @@ var tanstackQueryConfig = [
|
|
|
873
898
|
}
|
|
874
899
|
];
|
|
875
900
|
|
|
901
|
+
// src/presets/typescript/eslint-configs/turbo.ts
|
|
902
|
+
import turboPlugin from "eslint-plugin-turbo";
|
|
903
|
+
var turboConfig = [turboPlugin.configs["flat/recommended"]];
|
|
904
|
+
|
|
876
905
|
// src/presets/typescript/eslint-configs/vitest.ts
|
|
877
906
|
import vitestPlugin from "eslint-plugin-vitest";
|
|
878
907
|
var vitestConfig = [
|
|
@@ -934,7 +963,9 @@ var eslintPlugin = {
|
|
|
934
963
|
tailwind: tailwindConfig,
|
|
935
964
|
tanstackQuery: tanstackQueryConfig,
|
|
936
965
|
vitest: vitestConfig,
|
|
937
|
-
playwright: playwrightConfig
|
|
966
|
+
playwright: playwrightConfig,
|
|
967
|
+
storybook: storybookConfig,
|
|
968
|
+
turbo: turboConfig
|
|
938
969
|
},
|
|
939
970
|
detect,
|
|
940
971
|
rules,
|
|
@@ -952,10 +983,12 @@ export {
|
|
|
952
983
|
recommendedTypeScriptReact,
|
|
953
984
|
nextOnlyRules,
|
|
954
985
|
recommendedTypeScriptNext,
|
|
986
|
+
storybookConfig,
|
|
955
987
|
tailwindConfig,
|
|
956
988
|
tanstackQueryConfig,
|
|
989
|
+
turboConfig,
|
|
957
990
|
vitestConfig,
|
|
958
991
|
eslintPlugin,
|
|
959
992
|
typescript_default
|
|
960
993
|
};
|
|
961
|
-
//# sourceMappingURL=chunk-
|
|
994
|
+
//# sourceMappingURL=chunk-NXSSFAFS.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/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 { 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: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.git/**'],\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\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 * 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 EXCEPT no-skipped-test (stays warn for TDD).\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 * Exception: no-skipped-test stays at warn (legitimate TDD pattern).\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 // EXCEPTION: stays at warn (legitimate TDD pattern)\n 'playwright/no-skipped-test': 'warn',\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-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 },\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']];\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 'eslint-plugin-vitest';\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 // 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 safeword from 'safeword/eslint';\n * export default [...safeword.configs.recommendedTypeScript];\n *\n * Or with multiple configs:\n * import safeword from 'safeword/eslint';\n * export default [\n * ...safeword.configs.recommendedTypeScript,\n * ...safeword.configs.vitest,\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 { 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 };\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 };\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 },\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 },\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 { 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,SAAS,sCAAsC;AAC/C,SAAS,eAAe;AACxB,OAAO,mBAAmB;AAC1B,SAAS,WAAW,qBAAqB;AACzC,OAAO,oBAAoB;AAC3B,OAAO,sBAAsB;AAC7B,SAAS,WAAW,oBAAoB;AACxC,OAAO,aAAa;;;ACgBpB,SAAS,aAAa,MAA+B;AACnD,QAAM,EAAE,OAAO,IAAI;AACnB,SACE,OAAO,SAAS,sBAChB,OAAO,SAAS,SAAS,gBACzB,OAAO,SAAS,SAAS;AAE7B;AAKA,SAAS,mBACP,UACoB;AACpB,QAAM,iBAAiB,SAAS,OAAO,CAAC;AACxC,MAAI,gBAAgB,SAAS,cAAc;AACzC,WAAO,eAAe;AAAA,EACxB;AACA,SAAO;AACT;AAKA,SAAS,mBAAmB,QAAuB,SAA0B;AAC3E,SAAO,OAAO,SAAS,SAAS,gBAAgB,OAAO,SAAS,SAAS;AAC3E;AAKA,SAAS,mBACP,MACA,SAC2B;AAC3B,aAAW,YAAY,KAAK,YAAY;AACtC,QAAI,SAAS,SAAS,mBAAmB,mBAAmB,UAAU,OAAO,GAAG;AAC9E,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAKA,SAA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;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,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAAC;AACF;AAmBA,IAAO,qBAAQ;","names":["rule","rule","default","default","importX","importX","default","default"]}
|
|
@@ -88,6 +88,9 @@ function hasVitest(deps) {
|
|
|
88
88
|
function hasPlaywright(deps) {
|
|
89
89
|
return PLAYWRIGHT_PACKAGES.some((pkg) => pkg in deps);
|
|
90
90
|
}
|
|
91
|
+
function hasTurbo(deps) {
|
|
92
|
+
return "turbo" in deps;
|
|
93
|
+
}
|
|
91
94
|
function detectFramework(deps) {
|
|
92
95
|
if ("next" in deps) return "next";
|
|
93
96
|
if ("astro" in deps) return "astro";
|
|
@@ -154,6 +157,7 @@ var detect = {
|
|
|
154
157
|
hasTanstackQuery,
|
|
155
158
|
hasVitest,
|
|
156
159
|
hasPlaywright,
|
|
160
|
+
hasTurbo,
|
|
157
161
|
// Monorepo detection
|
|
158
162
|
findNextConfigPaths,
|
|
159
163
|
// Existing tooling detection
|
|
@@ -164,4 +168,4 @@ var detect = {
|
|
|
164
168
|
export {
|
|
165
169
|
detect
|
|
166
170
|
};
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
171
|
+
//# sourceMappingURL=chunk-PMYWVDOF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/presets/typescript/detect.ts"],"sourcesContent":["/**\n * Framework detection utilities for safeword ESLint preset\n *\n * Single source of truth for package detection. Used by:\n * - Generated eslint.config.mjs at lint time\n * - CLI's project-detector at init time\n */\n\nimport { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport path from 'node:path';\n\n/**\n * TanStack Query package names across all supported frameworks.\n */\nconst TANSTACK_QUERY_PACKAGES = [\n '@tanstack/react-query',\n '@tanstack/vue-query',\n '@tanstack/solid-query',\n '@tanstack/svelte-query',\n '@tanstack/angular-query-experimental',\n] as const;\n\n/**\n * Tailwind CSS package names (v3 and v4 installation methods).\n */\nconst TAILWIND_PACKAGES = ['tailwindcss', '@tailwindcss/vite', '@tailwindcss/postcss'] as const;\n\n/**\n * Playwright test package names.\n */\nconst PLAYWRIGHT_PACKAGES = ['@playwright/test', 'playwright'] as const;\n\n/**\n * Non-Prettier formatter config files (Biome, dprint, Rome).\n * Used to detect if project uses an alternative formatter.\n * Prettier is safeword's default, so its presence doesn't skip config creation.\n */\nconst ALTERNATIVE_FORMATTER_FILES = [\n // Biome (and legacy Rome)\n 'biome.json',\n 'biome.jsonc',\n 'rome.json',\n // dprint\n 'dprint.json',\n '.dprint.json',\n 'dprint.jsonc',\n '.dprint.jsonc',\n] as const;\n\ntype DepsRecord = Record<string, string | undefined>;\ntype ScriptsRecord = Record<string, string | undefined>;\n\n/**\n * Read dependencies from a package.json file.\n */\nfunction readPackageDeps(pkgPath: string): DepsRecord {\n try {\n if (!existsSync(pkgPath)) return {};\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));\n return { ...pkg.dependencies, ...pkg.devDependencies };\n } catch {\n return {};\n }\n}\n\n/**\n * Get workspace patterns from root package.json.\n */\nfunction getWorkspacePatternsFromPackage(rootPackagePath: string): string[] {\n try {\n const rootPackage = JSON.parse(readFileSync(rootPackagePath, 'utf8'));\n if (Array.isArray(rootPackage.workspaces)) {\n return rootPackage.workspaces;\n }\n if (rootPackage.workspaces?.packages) {\n return rootPackage.workspaces.packages;\n }\n } catch {\n // No workspaces defined\n }\n return [];\n}\n\n/**\n * Get all monorepo workspace patterns (from package.json + common directories).\n */\nfunction getMonorepoPatterns(rootDirectory: string): string[] {\n const rootPackagePath = path.join(rootDirectory, 'package.json');\n const workspacePatterns = getWorkspacePatternsFromPackage(rootPackagePath);\n const commonPatterns = ['apps/*', 'packages/*'];\n return [...new Set([...workspacePatterns, ...commonPatterns])];\n}\n\n/**\n * Scan a workspace directory for package.json files.\n */\nfunction scanWorkspaceDirectory(rootDirectory: string, pattern: string): DepsRecord {\n if (!pattern.endsWith('/*')) return {};\n\n const baseDirectory = path.join(rootDirectory, pattern.slice(0, -2));\n if (!existsSync(baseDirectory)) return {};\n\n const allDeps: DepsRecord = {};\n try {\n const entries = readdirSync(baseDirectory, { withFileTypes: true });\n for (const entry of entries) {\n if (entry.isDirectory()) {\n Object.assign(\n allDeps,\n readPackageDeps(path.join(baseDirectory, entry.name, 'package.json')),\n );\n }\n }\n } catch {\n // Ignore read errors\n }\n return allDeps;\n}\n\n/**\n * Collect all dependencies from root and workspace package.json files.\n * Supports npm/yarn workspaces and common monorepo patterns.\n */\nfunction collectAllDeps(rootDirectory: string): DepsRecord {\n const rootPackagePath = path.join(rootDirectory, 'package.json');\n const allDeps = readPackageDeps(rootPackagePath);\n\n // Scan each workspace pattern\n for (const pattern of getMonorepoPatterns(rootDirectory)) {\n Object.assign(allDeps, scanWorkspaceDirectory(rootDirectory, pattern));\n }\n\n return allDeps;\n}\n\n/**\n * Check if Tailwind CSS is installed.\n */\nfunction hasTailwind(deps: DepsRecord): boolean {\n return TAILWIND_PACKAGES.some(pkg => pkg in deps);\n}\n\n/**\n * Check if TanStack Query is installed.\n */\nfunction hasTanstackQuery(deps: DepsRecord): boolean {\n return TANSTACK_QUERY_PACKAGES.some(pkg => pkg in deps);\n}\n\n/**\n * Check if Vitest is installed.\n */\nfunction hasVitest(deps: DepsRecord): boolean {\n return 'vitest' in deps;\n}\n\n/**\n * Check if Playwright is installed.\n */\nfunction hasPlaywright(deps: DepsRecord): boolean {\n return PLAYWRIGHT_PACKAGES.some(pkg => pkg in deps);\n}\n\n/**\n * Check if Turborepo is installed.\n */\nfunction hasTurbo(deps: DepsRecord): boolean {\n return 'turbo' in deps;\n}\n\n/**\n * Detect base framework for config selection.\n * Returns the most specific framework detected.\n */\nfunction detectFramework(\n deps: DepsRecord,\n): 'next' | 'react' | 'astro' | 'typescript' | 'javascript' {\n if ('next' in deps) return 'next';\n if ('astro' in deps) return 'astro'; // Check before React (Astro+React has both)\n if ('react' in deps) return 'react';\n if ('typescript' in deps || 'typescript-eslint' in deps) return 'typescript';\n return 'javascript';\n}\n\n/**\n * Get dynamic ignores based on detected frameworks.\n */\nfunction getIgnores(deps: DepsRecord): string[] {\n const ignores = ['**/node_modules/', '**/dist/', '**/build/', '**/coverage/'];\n if ('next' in deps) ignores.push('**/.next/');\n if ('astro' in deps) ignores.push('**/.astro/');\n return ignores;\n}\n\n/**\n * Check if project has an existing linter setup.\n * True if package.json has a \"lint\" script.\n */\nfunction hasExistingLinter(scripts: ScriptsRecord): boolean {\n return 'lint' in scripts;\n}\n\n/**\n * Check if project uses an alternative formatter (Biome, dprint, Rome).\n * Returns false for Prettier since it's safeword's default.\n *\n * We don't check for \"format\" script because safeword adds that itself.\n */\nfunction hasExistingFormatter(cwd: string, _scripts: ScriptsRecord): boolean {\n return ALTERNATIVE_FORMATTER_FILES.some(file => existsSync(path.join(cwd, file)));\n}\n\n/**\n * Next.js config file names to look for.\n */\nconst NEXT_CONFIG_FILES = ['next.config.js', 'next.config.mjs', 'next.config.ts'] as const;\n\n/**\n * Check if a directory contains a Next.js config file.\n */\nfunction hasNextConfig(directory: string): boolean {\n return NEXT_CONFIG_FILES.some(file => existsSync(path.join(directory, file)));\n}\n\n/**\n * Scan a workspace directory for Next.js config files.\n * Returns relative glob patterns for directories containing Next.js configs.\n */\nfunction scanDirectoryForNextConfigs(rootDirectory: string, workspacePattern: string): string[] {\n if (!workspacePattern.endsWith('/*')) return [];\n\n const baseDirectory = workspacePattern.slice(0, -2); // Remove '/*'\n const fullBaseDirectory = path.join(rootDirectory, baseDirectory);\n\n if (!existsSync(fullBaseDirectory)) return [];\n\n const nextPaths: string[] = [];\n try {\n const entries = readdirSync(fullBaseDirectory, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const packageDirectory = path.join(fullBaseDirectory, entry.name);\n if (hasNextConfig(packageDirectory)) {\n nextPaths.push(`${baseDirectory}/${entry.name}/**/*.{ts,tsx}`);\n }\n }\n } catch {\n // Ignore read errors\n }\n return nextPaths;\n}\n\n/**\n * Find Next.js config paths for ESLint rule scoping in monorepos.\n *\n * Returns:\n * - `undefined` if Next.js config exists at root (single app, no scoping needed)\n * - `string[]` of glob patterns for directories containing Next.js apps\n * - Empty array if no Next.js configs found anywhere\n *\n * Used to scope Next.js-specific ESLint rules to only the packages that use Next.js,\n * allowing other packages (React, Astro, etc.) to avoid irrelevant Next.js rules.\n */\nfunction findNextConfigPaths(rootDirectory: string): string[] | undefined {\n // Check for root Next.js config - means single app, no scoping needed\n if (hasNextConfig(rootDirectory)) {\n return undefined;\n }\n\n // Scan each workspace pattern for Next.js configs\n return getMonorepoPatterns(rootDirectory).flatMap(pattern =>\n scanDirectoryForNextConfigs(rootDirectory, pattern),\n );\n}\n\n/**\n * All detection utilities bundled together.\n */\nexport const detect = {\n // Package lists\n TAILWIND_PACKAGES,\n TANSTACK_QUERY_PACKAGES,\n PLAYWRIGHT_PACKAGES,\n ALTERNATIVE_FORMATTER_FILES,\n NEXT_CONFIG_FILES,\n\n // Core utilities\n collectAllDeps,\n detectFramework,\n getIgnores,\n\n // Feature detection\n hasTailwind,\n hasTanstackQuery,\n hasVitest,\n hasPlaywright,\n hasTurbo,\n\n // Monorepo detection\n findNextConfigPaths,\n\n // Existing tooling detection\n hasExistingLinter,\n hasExistingFormatter,\n};\n"],"mappings":";AAQA,SAAS,YAAY,aAAa,oBAAoB;AACtD,OAAO,UAAU;AAKjB,IAAM,0BAA0B;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKA,IAAM,oBAAoB,CAAC,eAAe,qBAAqB,sBAAsB;AAKrF,IAAM,sBAAsB,CAAC,oBAAoB,YAAY;AAO7D,IAAM,8BAA8B;AAAA;AAAA,EAElC;AAAA,EAC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3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PMYWVDOF.js";
|
|
4
4
|
import {
|
|
5
5
|
VERSION
|
|
6
6
|
} from "./chunk-ORQHKDT2.js";
|
|
@@ -913,6 +913,17 @@ const scopedNextConfigs = nextPaths?.flatMap((filePath) =>
|
|
|
913
913
|
configs.nextOnlyRules.map((config) => ({ ...config, files: [filePath] }))
|
|
914
914
|
) ?? [];`;
|
|
915
915
|
}
|
|
916
|
+
var OPTIONAL_CONFIGS_SNIPPET = ` // Testing configs - always included (file-scoped to *.test.* and *.e2e.*)
|
|
917
|
+
...configs.vitest,
|
|
918
|
+
...configs.playwright,
|
|
919
|
+
// Storybook - always included (file-scoped to *.stories.*)
|
|
920
|
+
...configs.storybook,
|
|
921
|
+
// TanStack Query - always included (rules only match useQuery/useMutation patterns)
|
|
922
|
+
...configs.tanstackQuery,
|
|
923
|
+
// Tailwind - only if detected (plugin needs tailwind config to validate classes)
|
|
924
|
+
...(detect.hasTailwind(deps) ? configs.tailwind : []),
|
|
925
|
+
// Turborepo - only if detected (validates env vars are declared in turbo.json)
|
|
926
|
+
...(detect.hasTurbo(deps) ? configs.turbo : []),`;
|
|
916
927
|
var SAFEWORD_STRICT_RULES_FULL = `// Safeword strict rules - applied after project rules (win on conflict)
|
|
917
928
|
const safewordStrictRules = {
|
|
918
929
|
rules: {
|
|
@@ -966,13 +977,7 @@ export default [
|
|
|
966
977
|
{ ignores: detect.getIgnores(deps) },
|
|
967
978
|
...baseConfigs[framework],
|
|
968
979
|
...scopedNextConfigs,
|
|
969
|
-
|
|
970
|
-
...configs.vitest,
|
|
971
|
-
...configs.playwright,
|
|
972
|
-
// TanStack Query - always included (rules only match useQuery/useMutation patterns)
|
|
973
|
-
...configs.tanstackQuery,
|
|
974
|
-
// Tailwind - only if detected (plugin needs tailwind config to validate classes)
|
|
975
|
-
...(detect.hasTailwind(deps) ? configs.tailwind : []),
|
|
980
|
+
${OPTIONAL_CONFIGS_SNIPPET}
|
|
976
981
|
eslintConfigPrettier,
|
|
977
982
|
];
|
|
978
983
|
`;
|
|
@@ -993,13 +998,7 @@ export default [
|
|
|
993
998
|
{ ignores: detect.getIgnores(deps) },
|
|
994
999
|
...baseConfigs[framework],
|
|
995
1000
|
...scopedNextConfigs,
|
|
996
|
-
|
|
997
|
-
...configs.vitest,
|
|
998
|
-
...configs.playwright,
|
|
999
|
-
// TanStack Query - always included (rules only match useQuery/useMutation patterns)
|
|
1000
|
-
...configs.tanstackQuery,
|
|
1001
|
-
// Tailwind - only if detected (plugin needs tailwind config to validate classes)
|
|
1002
|
-
...(detect.hasTailwind(deps) ? configs.tailwind : []),
|
|
1001
|
+
${OPTIONAL_CONFIGS_SNIPPET}
|
|
1003
1002
|
];
|
|
1004
1003
|
`;
|
|
1005
1004
|
}
|
|
@@ -1014,10 +1013,11 @@ function getSafewordEslintConfig(existingConfig, hasExistingFormatter2 = false)
|
|
|
1014
1013
|
}
|
|
1015
1014
|
function getSafewordEslintConfigExtending(existingConfig, hasExistingFormatter2) {
|
|
1016
1015
|
const prettier = getPrettierConfig(hasExistingFormatter2);
|
|
1016
|
+
const safewordImport = hasExistingFormatter2 ? "" : 'import safeword from "safeword/eslint";\n';
|
|
1017
1017
|
return `// Safeword ESLint config - extends project config with stricter rules
|
|
1018
1018
|
// Used by hooks for LLM enforcement. Human pre-commits use project config.
|
|
1019
1019
|
// Re-run \`safeword upgrade\` to regenerate after project config changes.
|
|
1020
|
-
${prettier.import}
|
|
1020
|
+
${safewordImport}${prettier.import}
|
|
1021
1021
|
|
|
1022
1022
|
let projectConfig = [];
|
|
1023
1023
|
try {
|
|
@@ -1041,13 +1041,14 @@ ${prettier.configEntry}
|
|
|
1041
1041
|
}
|
|
1042
1042
|
function getSafewordEslintConfigLegacy(existingConfig, hasExistingFormatter2) {
|
|
1043
1043
|
const prettier = getPrettierConfig(hasExistingFormatter2);
|
|
1044
|
+
const safewordImport = hasExistingFormatter2 ? "" : 'import safeword from "safeword/eslint";\n';
|
|
1044
1045
|
return `// Safeword ESLint config - extends legacy project config with stricter rules
|
|
1045
1046
|
// Used by hooks for LLM enforcement. Human pre-commits use project config.
|
|
1046
1047
|
// NOTE: Legacy .eslintrc.* format is deprecated. Consider migrating to eslint.config.mjs
|
|
1047
1048
|
import { dirname } from "node:path";
|
|
1048
1049
|
import { fileURLToPath } from "node:url";
|
|
1049
1050
|
import { FlatCompat } from "@eslint/eslintrc";
|
|
1050
|
-
${prettier.import}
|
|
1051
|
+
${safewordImport}${prettier.import}
|
|
1051
1052
|
|
|
1052
1053
|
console.warn("Safeword: Legacy .eslintrc.* detected. Consider migrating to eslint.config.mjs");
|
|
1053
1054
|
|
|
@@ -1095,13 +1096,7 @@ export default [
|
|
|
1095
1096
|
{ ignores: detect.getIgnores(deps) },
|
|
1096
1097
|
...baseConfigs[framework],
|
|
1097
1098
|
...scopedNextConfigs,
|
|
1098
|
-
|
|
1099
|
-
...configs.vitest,
|
|
1100
|
-
...configs.playwright,
|
|
1101
|
-
// TanStack Query - always included (rules only match useQuery/useMutation patterns)
|
|
1102
|
-
...configs.tanstackQuery,
|
|
1103
|
-
// Tailwind - only if detected (plugin needs tailwind config to validate classes)
|
|
1104
|
-
...(detect.hasTailwind(deps) ? configs.tailwind : []),
|
|
1099
|
+
${OPTIONAL_CONFIGS_SNIPPET}
|
|
1105
1100
|
safewordStrictRules,
|
|
1106
1101
|
${prettier.configEntry}
|
|
1107
1102
|
];
|
|
@@ -1180,6 +1175,46 @@ var SETTINGS_HOOKS = {
|
|
|
1180
1175
|
};
|
|
1181
1176
|
|
|
1182
1177
|
// src/packs/typescript/files.ts
|
|
1178
|
+
function addKnipIgnores(config, ctx) {
|
|
1179
|
+
const allDeps = ctx.developmentDeps;
|
|
1180
|
+
if (ctx.projectType.nextjs) config.ignore.push(".next/**");
|
|
1181
|
+
if (ctx.projectType.astro) config.ignore.push(".astro/**");
|
|
1182
|
+
if ("storybook" in allDeps || "@storybook/react" in allDeps) {
|
|
1183
|
+
config.ignore.push(".storybook/**", "storybook-static/**");
|
|
1184
|
+
}
|
|
1185
|
+
if ("turbo" in allDeps) config.ignore.push(".turbo/**");
|
|
1186
|
+
if ("electron" in allDeps || "electron" in ctx.productionDeps) {
|
|
1187
|
+
config.ignore.push("electron/**", "dist-electron/**", "out/**");
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
function addKnipIgnoreDependencies(config, ctx) {
|
|
1191
|
+
const allDeps = ctx.developmentDeps;
|
|
1192
|
+
if (ctx.projectType.tailwind) {
|
|
1193
|
+
config.ignoreDependencies.push("tailwindcss", "@tailwindcss/typography", "@tailwindcss/forms");
|
|
1194
|
+
}
|
|
1195
|
+
if (ctx.projectType.playwright) config.ignoreDependencies.push("@playwright/test");
|
|
1196
|
+
if ("husky" in allDeps) config.ignoreDependencies.push("husky");
|
|
1197
|
+
if ("lint-staged" in allDeps) config.ignoreDependencies.push("lint-staged");
|
|
1198
|
+
if ("electron" in allDeps || "electron" in ctx.productionDeps) {
|
|
1199
|
+
config.ignoreDependencies.push(
|
|
1200
|
+
"electron",
|
|
1201
|
+
"electron-builder",
|
|
1202
|
+
"electron-updater",
|
|
1203
|
+
"electron-devtools-installer",
|
|
1204
|
+
"electron-is-dev",
|
|
1205
|
+
"electron-store"
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
function getKnipConfig(ctx) {
|
|
1210
|
+
const config = {
|
|
1211
|
+
ignore: [".safeword/**"],
|
|
1212
|
+
ignoreDependencies: ["safeword", "dependency-cruiser"]
|
|
1213
|
+
};
|
|
1214
|
+
addKnipIgnores(config, ctx);
|
|
1215
|
+
addKnipIgnoreDependencies(config, ctx);
|
|
1216
|
+
return config;
|
|
1217
|
+
}
|
|
1183
1218
|
var PRETTIER_DEFAULTS = {
|
|
1184
1219
|
semi: true,
|
|
1185
1220
|
singleQuote: true,
|
|
@@ -1303,15 +1338,9 @@ var typescriptManagedFiles = {
|
|
|
1303
1338
|
}
|
|
1304
1339
|
},
|
|
1305
1340
|
// Knip config for dead code detection (used by /audit)
|
|
1341
|
+
// Plugins auto-enable based on deps, we just configure ignore patterns
|
|
1306
1342
|
"knip.json": {
|
|
1307
|
-
generator: (ctx) => ctx.languages?.javascript ? JSON.stringify(
|
|
1308
|
-
{
|
|
1309
|
-
ignore: [".safeword/**"],
|
|
1310
|
-
ignoreDependencies: ["safeword"]
|
|
1311
|
-
},
|
|
1312
|
-
void 0,
|
|
1313
|
-
2
|
|
1314
|
-
) : void 0
|
|
1343
|
+
generator: (ctx) => ctx.languages?.javascript ? JSON.stringify(getKnipConfig(ctx), void 0, 2) : void 0
|
|
1315
1344
|
},
|
|
1316
1345
|
// Project-level Prettier config (created only if no existing formatter)
|
|
1317
1346
|
".prettierrc": {
|
|
@@ -1631,10 +1660,10 @@ var SAFEWORD_SCHEMA = {
|
|
|
1631
1660
|
...typescriptOwnedFiles,
|
|
1632
1661
|
...pythonOwnedFiles,
|
|
1633
1662
|
...golangOwnedFiles,
|
|
1634
|
-
// Hooks shared library
|
|
1663
|
+
// Hooks shared library - TypeScript with Bun runtime
|
|
1635
1664
|
".safeword/hooks/lib/lint.ts": { template: "hooks/lib/lint.ts" },
|
|
1636
1665
|
".safeword/hooks/lib/quality.ts": { template: "hooks/lib/quality.ts" },
|
|
1637
|
-
// Hooks
|
|
1666
|
+
// Hooks - TypeScript with Bun runtime
|
|
1638
1667
|
".safeword/hooks/session-verify-agents.ts": {
|
|
1639
1668
|
template: "hooks/session-verify-agents.ts"
|
|
1640
1669
|
},
|
|
@@ -1654,7 +1683,7 @@ var SAFEWORD_SCHEMA = {
|
|
|
1654
1683
|
template: "hooks/post-tool-lint.ts"
|
|
1655
1684
|
},
|
|
1656
1685
|
".safeword/hooks/stop-quality.ts": { template: "hooks/stop-quality.ts" },
|
|
1657
|
-
// Guides
|
|
1686
|
+
// Guides
|
|
1658
1687
|
".safeword/guides/architecture-guide.md": {
|
|
1659
1688
|
template: "guides/architecture-guide.md"
|
|
1660
1689
|
},
|
|
@@ -1685,7 +1714,7 @@ var SAFEWORD_SCHEMA = {
|
|
|
1685
1714
|
".safeword/guides/zombie-process-cleanup.md": {
|
|
1686
1715
|
template: "guides/zombie-process-cleanup.md"
|
|
1687
1716
|
},
|
|
1688
|
-
// Templates
|
|
1717
|
+
// Templates
|
|
1689
1718
|
".safeword/templates/architecture-template.md": {
|
|
1690
1719
|
template: "doc-templates/architecture-template.md"
|
|
1691
1720
|
},
|
|
@@ -1707,11 +1736,11 @@ var SAFEWORD_SCHEMA = {
|
|
|
1707
1736
|
".safeword/templates/work-log-template.md": {
|
|
1708
1737
|
template: "doc-templates/work-log-template.md"
|
|
1709
1738
|
},
|
|
1710
|
-
// Prompts
|
|
1739
|
+
// Prompts
|
|
1711
1740
|
".safeword/prompts/architecture.md": {
|
|
1712
1741
|
template: "prompts/architecture.md"
|
|
1713
1742
|
},
|
|
1714
|
-
// Scripts
|
|
1743
|
+
// Scripts
|
|
1715
1744
|
".safeword/scripts/bisect-test-pollution.sh": {
|
|
1716
1745
|
template: "scripts/bisect-test-pollution.sh"
|
|
1717
1746
|
},
|
|
@@ -1721,7 +1750,7 @@ var SAFEWORD_SCHEMA = {
|
|
|
1721
1750
|
".safeword/scripts/cleanup-zombies.sh": {
|
|
1722
1751
|
template: "scripts/cleanup-zombies.sh"
|
|
1723
1752
|
},
|
|
1724
|
-
// Claude skills
|
|
1753
|
+
// Claude skills and commands
|
|
1725
1754
|
".claude/skills/safeword-debugging/SKILL.md": {
|
|
1726
1755
|
template: "skills/safeword-debugging/SKILL.md"
|
|
1727
1756
|
},
|
|
@@ -1763,7 +1792,7 @@ var SAFEWORD_SCHEMA = {
|
|
|
1763
1792
|
template: "commands/quality-review.md"
|
|
1764
1793
|
},
|
|
1765
1794
|
".claude/commands/refactor.md": { template: "commands/refactor.md" },
|
|
1766
|
-
// Cursor rules
|
|
1795
|
+
// Cursor rules
|
|
1767
1796
|
".cursor/rules/safeword-core.mdc": {
|
|
1768
1797
|
template: "cursor/rules/safeword-core.mdc"
|
|
1769
1798
|
},
|
|
@@ -1809,7 +1838,7 @@ var SAFEWORD_SCHEMA = {
|
|
|
1809
1838
|
template: "commands/quality-review.md"
|
|
1810
1839
|
},
|
|
1811
1840
|
".cursor/commands/refactor.md": { template: "commands/refactor.md" },
|
|
1812
|
-
// Cursor hooks adapters
|
|
1841
|
+
// Cursor hooks adapters - TypeScript with Bun runtime
|
|
1813
1842
|
".safeword/hooks/cursor/after-file-edit.ts": {
|
|
1814
1843
|
template: "hooks/cursor/after-file-edit.ts"
|
|
1815
1844
|
},
|
|
@@ -2079,6 +2108,7 @@ function createProjectContext(cwd) {
|
|
|
2079
2108
|
cwd,
|
|
2080
2109
|
projectType: detectProjectType(packageJson ?? {}, cwd),
|
|
2081
2110
|
developmentDeps: packageJson?.devDependencies ?? {},
|
|
2111
|
+
productionDeps: packageJson?.dependencies ?? {},
|
|
2082
2112
|
isGitRepo: isGitRepo(cwd),
|
|
2083
2113
|
languages: detectLanguages(cwd)
|
|
2084
2114
|
};
|
|
@@ -2100,4 +2130,4 @@ export {
|
|
|
2100
2130
|
detectLanguages,
|
|
2101
2131
|
createProjectContext
|
|
2102
2132
|
};
|
|
2103
|
-
//# sourceMappingURL=chunk-
|
|
2133
|
+
//# sourceMappingURL=chunk-SO45XRNO.js.map
|