safeword 0.26.1 → 0.28.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.
- package/dist/{check-6763ESQ6.js → check-K6IUXV6G.js} +3 -3
- package/dist/{chunk-3GIBXEUI.js → chunk-6ZRDSDK4.js} +28 -5
- package/dist/chunk-6ZRDSDK4.js.map +1 -0
- package/dist/{chunk-Q4VPBNNZ.js → chunk-PEKTMTDF.js} +15 -1
- package/dist/chunk-PEKTMTDF.js.map +1 -0
- package/dist/{chunk-5IOM3XLW.js → chunk-TWPDXBMG.js} +2 -2
- package/dist/{chunk-NINE7AWZ.js → chunk-VCQT7SZS.js} +35 -39
- package/dist/chunk-VCQT7SZS.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{diff-O6NACWXR.js → diff-FKZODCH2.js} +3 -3
- package/dist/index.js +2 -2
- package/dist/presets/typescript/index.d.ts +7 -2
- package/dist/presets/typescript/index.js +2 -2
- package/dist/{reset-P5QGTALW.js → reset-2NYEOFWG.js} +3 -3
- package/dist/{setup-TGFZXS4G.js → setup-XKVCN7QI.js} +6 -5
- package/dist/{setup-TGFZXS4G.js.map → setup-XKVCN7QI.js.map} +1 -1
- package/dist/{upgrade-WL6K6B6O.js → upgrade-4GZEFY6D.js} +4 -4
- package/package.json +25 -23
- package/templates/AGENTS.md +1 -1
- package/templates/SAFEWORD.md +79 -68
- package/templates/commands/audit.md +5 -2
- package/templates/cursor/rules/safeword-quality-reviewing.mdc +2 -2
- package/templates/doc-templates/test-definitions-feature.md +9 -131
- package/templates/guides/context-files-guide.md +36 -1
- package/templates/guides/llm-writing-guide.md +9 -11
- package/templates/hooks/lib/active-ticket.ts +43 -2
- package/templates/hooks/lib/hierarchy.ts +1 -1
- package/templates/hooks/lib/lint.ts +35 -7
- package/templates/hooks/lib/quality-state.ts +84 -0
- package/templates/hooks/lib/quality.ts +49 -69
- package/templates/hooks/post-tool-bypass-warn.ts +1 -0
- package/templates/hooks/post-tool-quality.ts +23 -12
- package/templates/hooks/pre-tool-quality.ts +87 -78
- package/templates/hooks/prompt-questions.ts +143 -8
- package/templates/hooks/stop-quality.ts +138 -28
- package/templates/skills/audit/SKILL.md +282 -0
- package/templates/skills/bdd/DECOMPOSITION.md +8 -11
- package/templates/skills/bdd/DISCOVERY.md +13 -46
- package/templates/skills/bdd/DONE.md +10 -61
- package/templates/skills/bdd/SCENARIOS.md +10 -8
- package/templates/skills/bdd/SKILL.md +16 -12
- package/templates/skills/bdd/TDD.md +21 -58
- package/templates/skills/cleanup-zombies/SKILL.md +51 -0
- package/templates/skills/debug/SKILL.md +3 -1
- package/templates/skills/lint/SKILL.md +57 -0
- package/templates/skills/quality-review/SKILL.md +9 -2
- package/templates/skills/refactor/SKILL.md +6 -2
- package/templates/skills/testing/SKILL.md +6 -3
- package/templates/skills/ticket-system/SKILL.md +3 -1
- package/templates/skills/verify/SKILL.md +117 -0
- package/dist/chunk-3GIBXEUI.js.map +0 -1
- package/dist/chunk-NINE7AWZ.js.map +0 -1
- package/dist/chunk-Q4VPBNNZ.js.map +0 -1
- package/templates/guides/cli-reference.md +0 -43
- /package/dist/{check-6763ESQ6.js.map → check-K6IUXV6G.js.map} +0 -0
- /package/dist/{chunk-5IOM3XLW.js.map → chunk-TWPDXBMG.js.map} +0 -0
- /package/dist/{diff-O6NACWXR.js.map → diff-FKZODCH2.js.map} +0 -0
- /package/dist/{reset-P5QGTALW.js.map → reset-2NYEOFWG.js.map} +0 -0
- /package/dist/{upgrade-WL6K6B6O.js.map → upgrade-4GZEFY6D.js.map} +0 -0
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
createProjectContext,
|
|
7
7
|
getMissingPacks,
|
|
8
8
|
reconcile
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-VCQT7SZS.js";
|
|
10
|
+
import "./chunk-PEKTMTDF.js";
|
|
11
11
|
import {
|
|
12
12
|
VERSION
|
|
13
13
|
} from "./chunk-ORQHKDT2.js";
|
|
@@ -187,4 +187,4 @@ async function check(options) {
|
|
|
187
187
|
export {
|
|
188
188
|
check
|
|
189
189
|
};
|
|
190
|
-
//# sourceMappingURL=check-
|
|
190
|
+
//# sourceMappingURL=check-K6IUXV6G.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detect
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PEKTMTDF.js";
|
|
4
4
|
import {
|
|
5
5
|
VERSION
|
|
6
6
|
} from "./chunk-ORQHKDT2.js";
|
|
@@ -28,6 +28,7 @@ var astroConfig = [
|
|
|
28
28
|
|
|
29
29
|
// src/presets/typescript/eslint-configs/base.ts
|
|
30
30
|
import js from "@eslint/js";
|
|
31
|
+
import eslintComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
31
32
|
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
|
|
32
33
|
import { importX } from "eslint-plugin-import-x";
|
|
33
34
|
import pluginPromise from "eslint-plugin-promise";
|
|
@@ -541,6 +542,29 @@ var basePluginsUnscoped = [
|
|
|
541
542
|
"safeword/no-re-export-all": "error"
|
|
542
543
|
// Hurts tree-shaking
|
|
543
544
|
}
|
|
545
|
+
},
|
|
546
|
+
// ESLint native: flag stale disable directives (ESLint 9 default is warn, we want error)
|
|
547
|
+
{
|
|
548
|
+
name: "safeword/linter-options",
|
|
549
|
+
linterOptions: {
|
|
550
|
+
reportUnusedDisableDirectives: "error"
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
// ESLint disable comment governance - prevents broad/undocumented suppressions
|
|
554
|
+
{
|
|
555
|
+
name: "safeword/eslint-comments",
|
|
556
|
+
plugins: { "eslint-comments": eslintComments },
|
|
557
|
+
rules: {
|
|
558
|
+
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
559
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
560
|
+
// Must name specific rule
|
|
561
|
+
"eslint-comments/require-description": ["error", { ignore: ["eslint-enable"] }],
|
|
562
|
+
// Must explain why
|
|
563
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
564
|
+
// No redundant disables
|
|
565
|
+
"eslint-comments/no-unused-enable": "error"
|
|
566
|
+
// No orphaned enables
|
|
567
|
+
}
|
|
544
568
|
}
|
|
545
569
|
];
|
|
546
570
|
var basePlugins = scopeToFiles(basePluginsUnscoped, JS_TS_FILES);
|
|
@@ -583,8 +607,7 @@ var playwrightConfig = [
|
|
|
583
607
|
"playwright/no-useless-not": "error",
|
|
584
608
|
"playwright/no-wait-for-selector": "error",
|
|
585
609
|
"playwright/no-wait-for-timeout": "error",
|
|
586
|
-
|
|
587
|
-
"playwright/no-skipped-test": "warn",
|
|
610
|
+
"playwright/no-skipped-test": "error",
|
|
588
611
|
// Relax base rules for test files - each override has documented justification:
|
|
589
612
|
//
|
|
590
613
|
// no-empty-function: Tests often need empty callbacks for mocks/stubs:
|
|
@@ -922,7 +945,7 @@ var tanstackQueryConfig = [
|
|
|
922
945
|
|
|
923
946
|
// src/presets/typescript/eslint-configs/turbo.ts
|
|
924
947
|
import turboPlugin from "eslint-plugin-turbo";
|
|
925
|
-
var turboConfig = [turboPlugin.configs["flat/recommended"]];
|
|
948
|
+
var turboConfig = [turboPlugin.configs?.["flat/recommended"]].filter(Boolean);
|
|
926
949
|
|
|
927
950
|
// src/presets/typescript/eslint-configs/vitest.ts
|
|
928
951
|
import vitestPlugin from "eslint-plugin-vitest";
|
|
@@ -1029,4 +1052,4 @@ export {
|
|
|
1029
1052
|
eslintPlugin,
|
|
1030
1053
|
typescript_default
|
|
1031
1054
|
};
|
|
1032
|
-
//# sourceMappingURL=chunk-
|
|
1055
|
+
//# sourceMappingURL=chunk-6ZRDSDK4.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 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: ['**/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 // 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 * 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 '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 //\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 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,M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,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;;;ACLO,IAAM,eAA+B;AAAA,EAC1C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EACX;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"]}
|
|
@@ -10,6 +10,15 @@ var TANSTACK_QUERY_PACKAGES = [
|
|
|
10
10
|
];
|
|
11
11
|
var TAILWIND_PACKAGES = ["tailwindcss", "@tailwindcss/vite", "@tailwindcss/postcss"];
|
|
12
12
|
var PLAYWRIGHT_PACKAGES = ["@playwright/test", "playwright"];
|
|
13
|
+
var STORYBOOK_PACKAGES = [
|
|
14
|
+
"storybook",
|
|
15
|
+
"@storybook/react",
|
|
16
|
+
"@storybook/vue3",
|
|
17
|
+
"@storybook/svelte",
|
|
18
|
+
"@storybook/angular",
|
|
19
|
+
"@storybook/web-components",
|
|
20
|
+
"@storybook/html"
|
|
21
|
+
];
|
|
13
22
|
var ALTERNATIVE_FORMATTER_FILES = [
|
|
14
23
|
// Biome (and legacy Rome)
|
|
15
24
|
"biome.json",
|
|
@@ -91,6 +100,9 @@ function hasPlaywright(deps) {
|
|
|
91
100
|
function hasTurbo(deps) {
|
|
92
101
|
return "turbo" in deps;
|
|
93
102
|
}
|
|
103
|
+
function hasStorybook(deps) {
|
|
104
|
+
return STORYBOOK_PACKAGES.some((pkg) => pkg in deps);
|
|
105
|
+
}
|
|
94
106
|
function detectFramework(deps) {
|
|
95
107
|
if ("next" in deps) return "next";
|
|
96
108
|
if ("astro" in deps) return "astro";
|
|
@@ -157,6 +169,7 @@ var detect = {
|
|
|
157
169
|
TAILWIND_PACKAGES,
|
|
158
170
|
TANSTACK_QUERY_PACKAGES,
|
|
159
171
|
PLAYWRIGHT_PACKAGES,
|
|
172
|
+
STORYBOOK_PACKAGES,
|
|
160
173
|
ALTERNATIVE_FORMATTER_FILES,
|
|
161
174
|
NEXT_CONFIG_FILES,
|
|
162
175
|
// Core utilities
|
|
@@ -169,6 +182,7 @@ var detect = {
|
|
|
169
182
|
hasVitest,
|
|
170
183
|
hasPlaywright,
|
|
171
184
|
hasTurbo,
|
|
185
|
+
hasStorybook,
|
|
172
186
|
// Monorepo detection
|
|
173
187
|
findNextConfigPaths,
|
|
174
188
|
// Existing tooling detection
|
|
@@ -179,4 +193,4 @@ var detect = {
|
|
|
179
193
|
export {
|
|
180
194
|
detect
|
|
181
195
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
196
|
+
//# sourceMappingURL=chunk-PEKTMTDF.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 * Storybook package names (core CLI + common framework integrations).\n */\nconst STORYBOOK_PACKAGES = [\n 'storybook',\n '@storybook/react',\n '@storybook/vue3',\n '@storybook/svelte',\n '@storybook/angular',\n '@storybook/web-components',\n '@storybook/html',\n] 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 * Check if Storybook is installed.\n */\nfunction hasStorybook(deps: DepsRecord): boolean {\n return STORYBOOK_PACKAGES.some(pkg => pkg 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 * Standard ignore patterns for ESLint flat config.\n * Includes build output, tool caches, and non-JS ecosystems.\n */\nfunction getIgnores(): string[] {\n return [\n '**/node_modules/',\n '**/dist/',\n '**/build/',\n '**/coverage/',\n // Safeword's own hook/config files (TS, not in project's tsconfig scope)\n '.safeword/',\n // Build output directories — always ignore even if framework not currently installed\n '**/.next/',\n '**/.astro/',\n // Non-JS ecosystems that may contain JS files\n '**/.venv/',\n // Tool caches\n '**/.turbo/',\n ];\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 STORYBOOK_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 hasStorybook,\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;AAK7D,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOA,IAAM,8BAA8B;AAAA;AAAA,EAElC;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAQA,SAAS,gBAAgB,SAA6B;AACpD,MAAI;AACF,QAAI,CAAC,WAAW,OAAO,EAAG,QAAO,CAAC;AAClC,UAAM,MAAM,KAAK,MAAM,aAAa,SAAS,MAAM,CAAC;AACpD,WAAO,EAAE,GAAG,IAAI,cAAc,GAAG,IAAI,gBAAgB;AAAA,EACvD,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAKA,SAAS,gCAAgC,iBAAmC;AAC1E,MAAI;AACF,UAAM,cAAc,KAAK,MAAM,aAAa,iBAAiB,MAAM,CAAC;AACpE,QAAI,MAAM,QAAQ,YAAY,UAAU,GAAG;AACzC,aAAO,YAAY;AAAA,IACrB;AACA,QAAI,YAAY,YAAY,UAAU;AACpC,aAAO,YAAY,WAAW;AAAA,IAChC;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO,CAAC;AACV;AAKA,SAAS,oBAAoB,eAAiC;AAC5D,QAAM,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,mBAAmB,MAAM,IAAI;AAChE,UAAI,cAAc,gBAAgB,GAAG;AACnC,kBAAU,KAAK,GAAG,aAAa,IAAI,MAAM,IAAI,gBAAgB;AAAA,MAC/D;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAaA,SAAS,oBAAoB,eAA6C;AAExE,MAAI,cAAc,aAAa,GAAG;AAChC,WAAO;AAAA,EACT;AAGA,SAAO,oBAAoB,aAAa,EAAE;AAAA,IAAQ,aAChD,4BAA4B,eAAe,OAAO;AAAA,EACpD;AACF;AAKO,IAAM,SAAS;AAAA;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAGA;AAAA;AAAA,EAGA;AAAA,EACA;AACF;","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
addInstalledPack,
|
|
4
4
|
isGitRepo,
|
|
5
5
|
isPackInstalled
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VCQT7SZS.js";
|
|
7
7
|
|
|
8
8
|
// src/packs/install.ts
|
|
9
9
|
function installPack(packId, cwd) {
|
|
@@ -21,4 +21,4 @@ function installPack(packId, cwd) {
|
|
|
21
21
|
export {
|
|
22
22
|
installPack
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-TWPDXBMG.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
detect
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PEKTMTDF.js";
|
|
4
4
|
import {
|
|
5
5
|
VERSION
|
|
6
6
|
} from "./chunk-ORQHKDT2.js";
|
|
@@ -1279,8 +1279,7 @@ var pythonManagedFiles = {
|
|
|
1279
1279
|
},
|
|
1280
1280
|
// Project-level import-linter config (created only if layers detected and no existing config)
|
|
1281
1281
|
".importlinter": {
|
|
1282
|
-
//
|
|
1283
|
-
// eslint-disable-next-line sonarjs/no-inconsistent-returns
|
|
1282
|
+
// eslint-disable-next-line sonarjs/no-inconsistent-returns -- generator returns undefined to skip file
|
|
1284
1283
|
generator: (ctx) => {
|
|
1285
1284
|
if (!ctx.languages?.python) return;
|
|
1286
1285
|
if (ctx.projectType.existingImportLinterConfig) return;
|
|
@@ -1358,7 +1357,7 @@ function parseClippyKeys(content) {
|
|
|
1358
1357
|
const trimmed = line.trim();
|
|
1359
1358
|
if (trimmed && !trimmed.startsWith("#")) {
|
|
1360
1359
|
const match = /^([\w-]+)\s*=/.exec(trimmed);
|
|
1361
|
-
if (match) keys.add(match[1]);
|
|
1360
|
+
if (match?.[1]) keys.add(match[1]);
|
|
1362
1361
|
}
|
|
1363
1362
|
}
|
|
1364
1363
|
return keys;
|
|
@@ -1515,10 +1514,9 @@ function detectFromPythonDeps(cwd) {
|
|
|
1515
1514
|
content = readFileSync4(pyprojectPath, "utf8");
|
|
1516
1515
|
}
|
|
1517
1516
|
if (!content) return void 0;
|
|
1518
|
-
const
|
|
1519
|
-
for (const
|
|
1520
|
-
|
|
1521
|
-
const dialect = ADAPTER_TO_DIALECT[match[1]];
|
|
1517
|
+
const adapters = [...content.matchAll(/dbt-(\w+)/g)].map((m) => m[1]).filter((a) => a !== void 0 && a !== "core");
|
|
1518
|
+
for (const adapter of adapters) {
|
|
1519
|
+
const dialect = ADAPTER_TO_DIALECT[adapter];
|
|
1522
1520
|
if (dialect) return dialect;
|
|
1523
1521
|
}
|
|
1524
1522
|
return void 0;
|
|
@@ -1533,7 +1531,7 @@ function detectFromSqlcConfig(cwd) {
|
|
|
1533
1531
|
try {
|
|
1534
1532
|
const content = readFileSync4(nodePath9.join(directory, filename), "utf8");
|
|
1535
1533
|
const match = /engine['":\s]+(\w+)/.exec(content);
|
|
1536
|
-
if (match) return ADAPTER_TO_DIALECT[match[1]] ?? match[1];
|
|
1534
|
+
if (match?.[1]) return ADAPTER_TO_DIALECT[match[1]] ?? match[1];
|
|
1537
1535
|
} catch {
|
|
1538
1536
|
continue;
|
|
1539
1537
|
}
|
|
@@ -1546,7 +1544,7 @@ function detectFromPrismaSchema(cwd) {
|
|
|
1546
1544
|
try {
|
|
1547
1545
|
const content = readFileSync4(schemaPath, "utf8");
|
|
1548
1546
|
const match = /provider\s*=\s*"(\w+)"/.exec(content);
|
|
1549
|
-
if (!match) return void 0;
|
|
1547
|
+
if (!match?.[1]) return void 0;
|
|
1550
1548
|
return PROVIDER_TO_DIALECT[match[1]];
|
|
1551
1549
|
} catch {
|
|
1552
1550
|
return void 0;
|
|
@@ -1559,7 +1557,7 @@ function detectFromDrizzleConfig(cwd) {
|
|
|
1559
1557
|
try {
|
|
1560
1558
|
const content = readFileSync4(filePath, "utf8");
|
|
1561
1559
|
const match = /dialect\s*:\s*["'](\w+)["']/.exec(content);
|
|
1562
|
-
if (match) return DRIZZLE_TO_DIALECT[match[1]];
|
|
1560
|
+
if (match?.[1]) return DRIZZLE_TO_DIALECT[match[1]];
|
|
1563
1561
|
} catch {
|
|
1564
1562
|
continue;
|
|
1565
1563
|
}
|
|
@@ -1572,7 +1570,7 @@ function detectFromDatabaseUrl(cwd) {
|
|
|
1572
1570
|
try {
|
|
1573
1571
|
const content = readFileSync4(envPath, "utf8");
|
|
1574
1572
|
const match = /DATABASE_URL\s*=\s*["']?(\w+):/.exec(content);
|
|
1575
|
-
if (!match) return void 0;
|
|
1573
|
+
if (!match?.[1]) return void 0;
|
|
1576
1574
|
return SCHEME_TO_DIALECT[match[1]];
|
|
1577
1575
|
} catch {
|
|
1578
1576
|
return void 0;
|
|
@@ -1689,13 +1687,13 @@ const scopedNextConfigs = nextPaths?.flatMap((filePath) =>
|
|
|
1689
1687
|
configs.nextOnlyRules.map((config) => ({ ...config, files: [filePath] }))
|
|
1690
1688
|
) ?? [];`;
|
|
1691
1689
|
}
|
|
1692
|
-
var OPTIONAL_CONFIGS_SNIPPET = ` // Testing configs -
|
|
1693
|
-
...configs.vitest,
|
|
1694
|
-
...configs.playwright,
|
|
1695
|
-
// Storybook -
|
|
1696
|
-
...configs.storybook,
|
|
1697
|
-
// TanStack Query -
|
|
1698
|
-
...configs.tanstackQuery,
|
|
1690
|
+
var OPTIONAL_CONFIGS_SNIPPET = ` // Testing configs - only if detected (plugins have framework peer deps)
|
|
1691
|
+
...(detect.hasVitest(deps) ? configs.vitest : []),
|
|
1692
|
+
...(detect.hasPlaywright(deps) ? configs.playwright : []),
|
|
1693
|
+
// Storybook - only if detected (v10+ requires storybook peer dep)
|
|
1694
|
+
...(detect.hasStorybook(deps) ? configs.storybook : []),
|
|
1695
|
+
// TanStack Query - only if detected (has typescript peer dep)
|
|
1696
|
+
...(detect.hasTanstackQuery(deps) ? configs.tanstackQuery : []),
|
|
1699
1697
|
// Tailwind - only if detected (plugin needs tailwind config to validate classes)
|
|
1700
1698
|
...(detect.hasTailwind(deps) ? configs.tailwind : []),
|
|
1701
1699
|
// Turborepo - only if detected (validates env vars are declared in turbo.json)
|
|
@@ -2019,8 +2017,7 @@ var typescriptOwnedFiles = {
|
|
|
2019
2017
|
) : void 0
|
|
2020
2018
|
},
|
|
2021
2019
|
".safeword/.prettierrc": {
|
|
2022
|
-
//
|
|
2023
|
-
// eslint-disable-next-line sonarjs/no-inconsistent-returns
|
|
2020
|
+
// eslint-disable-next-line sonarjs/no-inconsistent-returns -- generator returns undefined to skip file
|
|
2024
2021
|
generator: (ctx) => {
|
|
2025
2022
|
if (!ctx.languages?.javascript || ctx.projectType.existingFormatter) {
|
|
2026
2023
|
return;
|
|
@@ -2034,8 +2031,7 @@ var typescriptOwnedFiles = {
|
|
|
2034
2031
|
var typescriptManagedFiles = {
|
|
2035
2032
|
// Project-level ESLint config (created only if no existing ESLint config)
|
|
2036
2033
|
"eslint.config.mjs": {
|
|
2037
|
-
//
|
|
2038
|
-
// eslint-disable-next-line sonarjs/no-inconsistent-returns
|
|
2034
|
+
// eslint-disable-next-line sonarjs/no-inconsistent-returns -- generator returns undefined to skip file
|
|
2039
2035
|
generator: (ctx) => {
|
|
2040
2036
|
if (ctx.projectType.existingEslintConfig) return;
|
|
2041
2037
|
if (!ctx.languages?.javascript) return;
|
|
@@ -2044,8 +2040,7 @@ var typescriptManagedFiles = {
|
|
|
2044
2040
|
},
|
|
2045
2041
|
// Minimal tsconfig for ESLint type-checked linting (only if missing)
|
|
2046
2042
|
"tsconfig.json": {
|
|
2047
|
-
//
|
|
2048
|
-
// eslint-disable-next-line sonarjs/no-inconsistent-returns
|
|
2043
|
+
// eslint-disable-next-line sonarjs/no-inconsistent-returns -- generator returns undefined to skip file
|
|
2049
2044
|
generator: (ctx) => {
|
|
2050
2045
|
if (!ctx.languages?.javascript) return;
|
|
2051
2046
|
if (!ctx.developmentDeps.typescript && !ctx.developmentDeps["typescript-eslint"]) {
|
|
@@ -2077,8 +2072,7 @@ var typescriptManagedFiles = {
|
|
|
2077
2072
|
},
|
|
2078
2073
|
// Project-level Prettier config (created only if no existing formatter)
|
|
2079
2074
|
".prettierrc": {
|
|
2080
|
-
//
|
|
2081
|
-
// eslint-disable-next-line sonarjs/no-inconsistent-returns
|
|
2075
|
+
// eslint-disable-next-line sonarjs/no-inconsistent-returns -- generator returns undefined to skip file
|
|
2082
2076
|
generator: (ctx) => {
|
|
2083
2077
|
if (!ctx.languages?.javascript) return;
|
|
2084
2078
|
if (ctx.projectType.existingFormatter) return;
|
|
@@ -2356,7 +2350,12 @@ var SAFEWORD_SCHEMA = {
|
|
|
2356
2350
|
".claude/commands/debug.md",
|
|
2357
2351
|
".claude/commands/quality-review.md",
|
|
2358
2352
|
".claude/commands/refactor.md",
|
|
2359
|
-
".claude/commands/testing.md"
|
|
2353
|
+
".claude/commands/testing.md",
|
|
2354
|
+
// Commands converted to skills (ticket 038)
|
|
2355
|
+
".claude/commands/lint.md",
|
|
2356
|
+
".claude/commands/verify.md",
|
|
2357
|
+
".claude/commands/audit.md",
|
|
2358
|
+
".claude/commands/cleanup-zombies.md"
|
|
2360
2359
|
],
|
|
2361
2360
|
// Packages to uninstall on upgrade (now bundled in safeword/eslint)
|
|
2362
2361
|
deprecatedPackages: [
|
|
@@ -2475,9 +2474,6 @@ var SAFEWORD_SCHEMA = {
|
|
|
2475
2474
|
".safeword/guides/architecture-guide.md": {
|
|
2476
2475
|
template: "guides/architecture-guide.md"
|
|
2477
2476
|
},
|
|
2478
|
-
".safeword/guides/cli-reference.md": {
|
|
2479
|
-
template: "guides/cli-reference.md"
|
|
2480
|
-
},
|
|
2481
2477
|
".safeword/guides/context-files-guide.md": {
|
|
2482
2478
|
template: "guides/context-files-guide.md"
|
|
2483
2479
|
},
|
|
@@ -2575,14 +2571,14 @@ var SAFEWORD_SCHEMA = {
|
|
|
2575
2571
|
".claude/skills/ticket-system/SKILL.md": {
|
|
2576
2572
|
template: "skills/ticket-system/SKILL.md"
|
|
2577
2573
|
},
|
|
2578
|
-
// Claude
|
|
2579
|
-
// Skills auto-create /slash-commands, so
|
|
2580
|
-
".claude/
|
|
2581
|
-
".claude/
|
|
2582
|
-
".claude/
|
|
2583
|
-
|
|
2574
|
+
// Claude skills — action commands with disable-model-invocation
|
|
2575
|
+
// Skills auto-create /slash-commands, so separate commands are unnecessary
|
|
2576
|
+
".claude/skills/lint/SKILL.md": { template: "skills/lint/SKILL.md" },
|
|
2577
|
+
".claude/skills/verify/SKILL.md": { template: "skills/verify/SKILL.md" },
|
|
2578
|
+
".claude/skills/audit/SKILL.md": { template: "skills/audit/SKILL.md" },
|
|
2579
|
+
".claude/skills/cleanup-zombies/SKILL.md": {
|
|
2580
|
+
template: "skills/cleanup-zombies/SKILL.md"
|
|
2584
2581
|
},
|
|
2585
|
-
".claude/commands/lint.md": { template: "commands/lint.md" },
|
|
2586
2582
|
// Cursor rules
|
|
2587
2583
|
".cursor/rules/safeword-core.mdc": {
|
|
2588
2584
|
template: "cursor/rules/safeword-core.mdc"
|
|
@@ -2937,4 +2933,4 @@ export {
|
|
|
2937
2933
|
detectLanguages2,
|
|
2938
2934
|
createProjectContext
|
|
2939
2935
|
};
|
|
2940
|
-
//# sourceMappingURL=chunk-
|
|
2936
|
+
//# sourceMappingURL=chunk-VCQT7SZS.js.map
|