@acme-skunkworks/eslint-config 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +5 -3
  3. package/dist/infrastructure/scripts/add-links-changelog.d.ts +12 -0
  4. package/dist/infrastructure/scripts/add-links-changelog.d.ts.map +1 -0
  5. package/dist/infrastructure/scripts/add-links-changelog.js +56 -0
  6. package/dist/infrastructure/scripts/enrich-changelog.d.ts +26 -0
  7. package/dist/infrastructure/scripts/enrich-changelog.d.ts.map +1 -0
  8. package/dist/infrastructure/scripts/enrich-changelog.js +60 -0
  9. package/dist/infrastructure/scripts/finalise-changelog.d.ts +26 -0
  10. package/dist/infrastructure/scripts/finalise-changelog.d.ts.map +1 -0
  11. package/dist/infrastructure/scripts/finalise-changelog.js +152 -0
  12. package/dist/infrastructure/scripts/stamp-changelog-version.d.ts +10 -0
  13. package/dist/infrastructure/scripts/stamp-changelog-version.d.ts.map +1 -0
  14. package/dist/infrastructure/scripts/stamp-changelog-version.js +35 -0
  15. package/dist/infrastructure/scripts/validate-changelog.d.ts +7 -0
  16. package/dist/infrastructure/scripts/validate-changelog.d.ts.map +1 -0
  17. package/dist/infrastructure/scripts/validate-changelog.js +216 -0
  18. package/dist/rules/astro.d.ts.map +1 -1
  19. package/dist/rules/astro.js +9 -6
  20. package/dist/rules/commonjs.d.ts +2 -1
  21. package/dist/rules/commonjs.d.ts.map +1 -1
  22. package/dist/rules/commonjs.js +2 -1
  23. package/dist/rules/complexity.d.ts.map +1 -1
  24. package/dist/rules/complexity.js +3 -0
  25. package/dist/rules/e2e.d.ts.map +1 -1
  26. package/dist/rules/e2e.js +3 -0
  27. package/dist/rules/frameworkRouting.d.ts.map +1 -1
  28. package/dist/rules/frameworkRouting.js +4 -3
  29. package/dist/rules/ignoredFileAndFolders.d.ts +1 -0
  30. package/dist/rules/ignoredFileAndFolders.d.ts.map +1 -1
  31. package/dist/rules/ignoredFileAndFolders.js +1 -0
  32. package/dist/rules/packageJson.d.ts.map +1 -1
  33. package/dist/rules/packageJson.js +3 -0
  34. package/dist/rules/preferences.d.ts.map +1 -1
  35. package/dist/rules/preferences.js +67 -29
  36. package/dist/rules/reactRouterExceptions.d.ts.map +1 -1
  37. package/dist/rules/reactRouterExceptions.js +3 -14
  38. package/dist/rules/sanity.d.ts +1 -1
  39. package/dist/rules/sanity.d.ts.map +1 -1
  40. package/dist/rules/sanity.js +18 -7
  41. package/dist/rules/storybook.d.ts.map +1 -1
  42. package/dist/rules/storybook.js +6 -2
  43. package/dist/rules/tableComponents.d.ts.map +1 -1
  44. package/dist/rules/tableComponents.js +3 -0
  45. package/dist/rules/testFiles.d.ts.map +1 -1
  46. package/dist/rules/testFiles.js +12 -10
  47. package/dist/rules/typescriptOverrides.d.ts.map +1 -1
  48. package/dist/rules/typescriptOverrides.js +6 -0
  49. package/package.json +12 -10
  50. package/dist/infrastructure/scripts/retitle-release-pr.d.ts +0 -11
  51. package/dist/infrastructure/scripts/retitle-release-pr.d.ts.map +0 -1
  52. package/dist/infrastructure/scripts/retitle-release-pr.js +0 -50
@@ -8,20 +8,23 @@ import { configs } from "eslint-plugin-astro";
8
8
  * `@/` tsconfig path alias, and direct `.astro` file imports.
9
9
  */
10
10
  export const astro = [
11
+ // eslint-plugin-astro flat/recommended — upstream preset (parser, env, core astro rules).
12
+ // https://github.com/ota-meshi/eslint-plugin-astro#configuration
11
13
  ...configs["flat/recommended"],
12
14
  {
13
15
  files: ["**/*.astro"],
14
16
  rules: {
17
+ // astro/no-set-html-directive — disallows `set:html` (XSS risk) in favour of safer patterns.
18
+ // Error: we treat unsanitised HTML injection as a hard failure in Astro templates.
19
+ // https://ota-meshi.github.io/eslint-plugin-astro/rules/no-set-html-directive/
15
20
  "astro/no-set-html-directive": "error",
16
- // Ignore imports that ESLint's static resolver can't handle in Astro files
21
+ // import/no-unresolved — reports imports that cannot be resolved to a file on disk.
22
+ // Error with ignore patterns: Astro virtual modules, path aliases, and .astro imports are valid but opaque to the resolver.
23
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unresolved.md
17
24
  "import/no-unresolved": [
18
25
  "error",
19
26
  {
20
- ignore: [
21
- "^astro:", // Astro virtual modules (astro:content, astro:assets, etc.)
22
- "^@/", // Path aliases defined in tsconfig (e.g., @/components)
23
- "\\.astro$", // .astro file imports (Astro's custom file format)
24
- ],
27
+ ignore: ["^astro:", "^@/", "\\.astro$"],
25
28
  },
26
29
  ],
27
30
  },
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * `.cjs` parser shim: sets `sourceType: "script"` plus Node + ES2021 globals
5
5
  * so CommonJS files (legacy config files, certain tooling shims) parse
6
- * cleanly under the otherwise-ESM-default flat config.
6
+ * cleanly under the otherwise-ESM-default flat config. No rules — only `languageOptions`.
7
+ * @see https://eslint.org/docs/latest/use/configure/language-options
7
8
  */
8
9
  export declare const commonjs: {
9
10
  files: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"commonjs.d.ts","sourceRoot":"","sources":["../../rules/commonjs.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcI,CAAC"}
1
+ {"version":3,"file":"commonjs.d.ts","sourceRoot":"","sources":["../../rules/commonjs.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcI,CAAC"}
@@ -4,7 +4,8 @@ import globals from "globals";
4
4
  *
5
5
  * `.cjs` parser shim: sets `sourceType: "script"` plus Node + ES2021 globals
6
6
  * so CommonJS files (legacy config files, certain tooling shims) parse
7
- * cleanly under the otherwise-ESM-default flat config.
7
+ * cleanly under the otherwise-ESM-default flat config. No rules — only `languageOptions`.
8
+ * @see https://eslint.org/docs/latest/use/configure/language-options
8
9
  */
9
10
  export const commonjs = {
10
11
  files: ["**/*.cjs"],
@@ -1 +1 @@
1
- {"version":3,"file":"complexity.d.ts","sourceRoot":"","sources":["../../rules/complexity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAOrC,CAAC"}
1
+ {"version":3,"file":"complexity.d.ts","sourceRoot":"","sources":["../../rules/complexity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAUrC,CAAC"}
@@ -18,6 +18,9 @@ export const complexity = [
18
18
  {
19
19
  files: ["**/scripts/**/*.{ts,tsx,js,mjs}"],
20
20
  rules: {
21
+ // complexity — limits cyclomatic complexity per function (branching paths).
22
+ // Error + max 40: orchestration scripts are linear step lists; default threshold is too low.
23
+ // https://eslint.org/docs/latest/rules/complexity
21
24
  complexity: ["error", 40],
22
25
  },
23
26
  },
@@ -1 +1 @@
1
- {"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../rules/e2e.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,GAAG;;;;;CAKS,CAAC"}
1
+ {"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../rules/e2e.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,GAAG;;;;;CAQS,CAAC"}
package/dist/rules/e2e.js CHANGED
@@ -14,6 +14,9 @@
14
14
  export const e2e = {
15
15
  files: ["**/e2e/**/*.{ts,tsx}"],
16
16
  rules: {
17
+ // react-hooks/rules-of-hooks — enforces Rules of Hooks (only call hooks at top level).
18
+ // Off in e2e: Playwright `test.extend` fixture factories are misread as hook calls.
19
+ // https://react.dev/reference/eslint-plugin-react-hooks#rules-of-hooks
17
20
  "react-hooks/rules-of-hooks": "off",
18
21
  },
19
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"frameworkRouting.d.ts","sourceRoot":"","sources":["../../rules/frameworkRouting.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB;;;;;CAcJ,CAAC"}
1
+ {"version":3,"file":"frameworkRouting.d.ts","sourceRoot":"","sources":["../../rules/frameworkRouting.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB;;;;;CAeJ,CAAC"}
@@ -22,9 +22,10 @@ export const frameworkRouting = {
22
22
  "**/src/pages/**/*.{ts,tsx,js,jsx}", // Astro pattern
23
23
  ],
24
24
  rules: {
25
- // Disable filename-match-exported for framework routing directories
26
- // File-based routing requires specific filenames (e.g., root.tsx, home.tsx)
27
- // that don't match exported component names (e.g., Layout, Home, meta)
25
+ // canonical/filename-match-exported requires default export name to match the filename.
26
+ // Off in routing dirs: file-based routes use conventional names (root.tsx, page.tsx) not export names.
27
+ // See: https://github.com/RobEasthope/protomolecule/issues/299
28
+ // https://github.com/gajus/eslint-plugin-canonical#rules
28
29
  "canonical/filename-match-exported": "off",
29
30
  },
30
31
  };
@@ -6,6 +6,7 @@
6
6
  * `.react-router`, `.wrangler`, `.vscode`, `.claude`), `node_modules`, and
7
7
  * the lock file. Also ignores `tsconfig.json` and the consumer's own
8
8
  * `eslint.config.{ts,mjs}` — those are tooling input, not source to lint.
9
+ * @see https://eslint.org/docs/latest/use/configure/ignore
9
10
  */
10
11
  export declare const ignoredFileAndFolders: {
11
12
  ignores: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"ignoredFileAndFolders.d.ts","sourceRoot":"","sources":["../../rules/ignoredFileAndFolders.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;CAmBT,CAAC"}
1
+ {"version":3,"file":"ignoredFileAndFolders.d.ts","sourceRoot":"","sources":["../../rules/ignoredFileAndFolders.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;CAmBT,CAAC"}
@@ -6,6 +6,7 @@
6
6
  * `.react-router`, `.wrangler`, `.vscode`, `.claude`), `node_modules`, and
7
7
  * the lock file. Also ignores `tsconfig.json` and the consumer's own
8
8
  * `eslint.config.{ts,mjs}` — those are tooling input, not source to lint.
9
+ * @see https://eslint.org/docs/latest/use/configure/ignore
9
10
  */
10
11
  export const ignoredFileAndFolders = {
11
12
  ignores: [
@@ -1 +1 @@
1
- {"version":3,"file":"packageJson.d.ts","sourceRoot":"","sources":["../../rules/packageJson.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;CAKC,CAAC"}
1
+ {"version":3,"file":"packageJson.d.ts","sourceRoot":"","sources":["../../rules/packageJson.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;CAQC,CAAC"}
@@ -9,6 +9,9 @@
9
9
  export const packageJson = {
10
10
  files: ["**/package.json"],
11
11
  rules: {
12
+ // jsonc/sort-keys — enforces alphabetical (or configured) key order in JSON/JSONC files.
13
+ // Off: sort-package-json (lint-staged) owns package.json field order with npm conventions.
14
+ // https://ota.github.io/eslint-plugin-jsonc/rules/sort-keys.html
12
15
  "jsonc/sort-keys": "off",
13
16
  },
14
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../rules/preferences.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GC,CAAC"}
1
+ {"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../rules/preferences.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoJC,CAAC"}
@@ -22,27 +22,38 @@ export const preferences = {
22
22
  },
23
23
  },
24
24
  rules: {
25
+ // canonical/filename-match-regex — requires exported symbol names to match a filename regex.
26
+ // Off: canonical's default regex is too strict for our file-routing and colocated-file patterns.
27
+ // https://github.com/gajus/eslint-plugin-canonical#rules
25
28
  "canonical/filename-match-regex": "off",
29
+ // canonical/id-match — enforces identifier naming conventions (regex/case).
30
+ // Off: conflicts with framework and library conventions (e.g. single-letter Sanity `S`).
31
+ // https://github.com/gajus/eslint-plugin-canonical#rules
26
32
  "canonical/id-match": "off",
27
- // Prefer top-level type imports for React Router 7 compatibility
28
- // Top-level: import type { Foo } from 'bar'
29
- // Inline: import { type Foo } from 'bar' (causes issues with virtual modules)
33
+ // canonical/prefer-inline-type-import — prefers `import { type Foo }` over `import type { Foo }`.
34
+ // Off: top-level type imports are required for React Router 7 virtual modules and verbatimModuleSyntax.
30
35
  // See: https://github.com/RobEasthope/protomolecule/issues/333
36
+ // https://github.com/gajus/eslint-plugin-canonical#rules
31
37
  "canonical/prefer-inline-type-import": "off",
32
- // Enforce function declarations as the standard pattern
33
- // Arrow functions and function expressions will error
34
- // Note: React Router 7 files (root.tsx, *route.tsx) need framework-specific exceptions
38
+ // func-style — requires `function foo() {}` over `const foo = function () {}` / arrows.
39
+ // Error + declaration: our default style; frameworkRouting relaxes root/route files.
35
40
  // See: https://github.com/RobEasthope/protomolecule/issues/299
41
+ // https://eslint.org/docs/latest/rules/func-style
36
42
  "func-style": ["error", "declaration"],
37
- // Prefer top-level type imports over inline type imports
38
- // This ensures compatibility with React Router 7 virtual modules and verbatimModuleSyntax
43
+ // import/consistent-type-specifier-style enforces where `type` appears in import specifiers.
44
+ // Error + prefer-top-level: separate `import type` lines for RR7 virtual modules compatibility.
39
45
  // See: https://github.com/RobEasthope/protomolecule/issues/333
46
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
40
47
  "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
41
- // Prevent duplicate imports from the same module
42
- // With prefer-inline: false, allows separate type and value imports
43
- // e.g., import { useState } from 'react' and import type { FC } from 'react'
48
+ // import/no-duplicates reports multiple import declarations from the same module.
49
+ // Error + prefer-inline false: allows separate value and type imports from one module.
44
50
  // See: https://github.com/RobEasthope/protomolecule/issues/333
51
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-duplicates.md
45
52
  "import/no-duplicates": ["error", { "prefer-inline": false }],
53
+ // import/no-extraneous-dependencies — forbids importing packages not listed in package.json.
54
+ // Error with devDependencies allowlist for tests, configs, scripts, and monorepo packageDir lookup.
55
+ // See: https://github.com/RobEasthope/protomolecule/issues/299
56
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
46
57
  "import/no-extraneous-dependencies": [
47
58
  "error",
48
59
  {
@@ -58,31 +69,38 @@ export const preferences = {
58
69
  ".github/scripts/**",
59
70
  "scripts/**",
60
71
  ],
61
- // Allow importing from @react-router/dev and similar framework dev packages
62
- // These are in devDependencies but required for route configuration at build time
63
- // See: https://github.com/RobEasthope/protomolecule/issues/299
64
72
  includeInternal: false,
65
73
  includeTypes: true,
66
74
  packageDir: ["./", "../", "../../"],
67
- // Allow importing from peerDependencies (for shared configs like eslint-config)
68
75
  peerDependencies: true,
69
76
  },
70
77
  ],
71
- // Allow CSS file imports (standard pattern in Vite, Next.js, React Router, Remix, Astro)
78
+ // import/no-unassigned-import forbids side-effect imports that bind no symbols.
79
+ // Error with CSS/SCSS/etc. allowlist: framework apps import stylesheets without bindings.
72
80
  // See: https://github.com/RobEasthope/protomolecule/issues/299
81
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-unassigned-import.md
73
82
  "import/no-unassigned-import": [
74
83
  "error",
75
84
  {
76
85
  allow: ["**/*.css", "**/*.scss", "**/*.sass", "**/*.less", "**/*.pcss"],
77
86
  },
78
87
  ],
88
+ // no-console — disallows `console` calls (with optional allowlist of methods).
89
+ // Warn + allow error/debug/warn/log: discourage casual logging but permit intentional use.
90
+ // https://eslint.org/docs/latest/rules/no-console
79
91
  "no-console": ["warn", { allow: ["error", "debug", "warn", "log"] }],
80
- // Allow empty patterns with type annotations (React Router v7, Remix, SvelteKit patterns)
81
- // e.g., `export function meta({}: Route.MetaArgs) { ... }`
82
- // The empty destructuring satisfies the type system even when arguments aren't used
92
+ // no-empty-pattern disallows empty object/array patterns in destructuring.
93
+ // Off: typed framework route args use `{}` placeholders (e.g. `meta({}: Route.MetaArgs)`).
83
94
  // See: https://github.com/RobEasthope/protomolecule/issues/299
95
+ // https://eslint.org/docs/latest/rules/no-empty-pattern
84
96
  "no-empty-pattern": "off",
97
+ // perfectionist/sort-modules — enforces ordering of ES module statements.
98
+ // Off: canonical enables this; we prefer manual/import-group ordering without auto-sort noise.
99
+ // https://perfectionist.dev/rules/sort-modules
85
100
  "perfectionist/sort-modules": "off",
101
+ // prettier/prettier — runs Prettier as an ESLint rule and reports formatting diffs.
102
+ // Error with tailwind plugin + cn/clsx: formatting is enforced at lint time, not only on save.
103
+ // https://github.com/prettier/eslint-plugin-prettier#options
86
104
  "prettier/prettier": [
87
105
  "error",
88
106
  {
@@ -91,33 +109,53 @@ export const preferences = {
91
109
  tailwindFunctions: ["cn", "clsx"],
92
110
  },
93
111
  ],
112
+ // quotes — enforces consistent quote style for strings.
113
+ // Warn + double + avoidEscape: align with Prettier double-quote default; escapes when needed.
114
+ // https://eslint.org/docs/latest/rules/quotes
94
115
  quotes: ["warn", "double", { avoidEscape: true }],
116
+ // react/forbid-component-props — bans specific props on DOM/components.
117
+ // Off: canonical's forbidden-prop list is too opinionated for our component libraries.
118
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
95
119
  "react/forbid-component-props": "off",
120
+ // react/function-component-definition — enforces arrow vs function declaration for components.
121
+ // Off: we use func-style globally instead; this rule duplicates and conflicts with RR7 patterns.
122
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
96
123
  "react/function-component-definition": "off",
124
+ // regexp/no-unused-capturing-group — flags capturing groups whose match is never used.
125
+ // Off: false positives on regexes where groups aid readability or future back-references.
126
+ // https://ota.github.io/eslint-plugin-regexp/rules/no-unused-capturing-group.html
97
127
  "regexp/no-unused-capturing-group": "off",
128
+ // require-unicode-regexp — requires the `u` flag on `RegExp` literals and constructors.
129
+ // Off: not all regexes need Unicode semantics; canonical's default is too strict for us.
130
+ // https://eslint.org/docs/latest/rules/require-unicode-regexp
98
131
  "require-unicode-regexp": "off",
132
+ // unicorn/better-regex — suggests regex optimizations (simpler patterns, fewer backtracks).
133
+ // Off: auto-suggestions conflict with intentionally explicit patterns in places.
134
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md
99
135
  "unicorn/better-regex": "off",
136
+ // unicorn/numeric-separators-style — enforces `_` separators in numeric literals.
137
+ // Off: style preference; teams vary on when separators help readability.
138
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
100
139
  "unicorn/numeric-separators-style": "off",
101
140
  },
102
141
  settings: {
103
- // TypeScript import resolver for monorepo support
104
- // Fixes false positives with import/no-extraneous-dependencies when lint-staged
105
- // passes absolute file paths in monorepo workspaces
142
+ // import-x/resolver — tells import-x rules how to resolve module paths (TypeScript projects).
143
+ // typescript resolver + monorepo tsconfig globs: fixes false positives when lint-staged passes absolute paths.
106
144
  // See: https://github.com/RobEasthope/protomolecule/issues/327
145
+ // https://github.com/import-js/eslint-import-resolver-typescript
107
146
  "import-x/resolver": {
108
147
  typescript: {
109
- // Always try to resolve types under `@types/*` directory
110
148
  alwaysTryTypes: true,
111
- // Support both monorepo and single-package projects
112
- // Monorepo: Multiple tsconfig files for workspace packages
113
- // Single package: Falls back to root tsconfig.json
114
149
  project: [
115
- "tsconfig.json", // Root or single package
116
- "apps/*/tsconfig.json", // Monorepo apps
117
- "packages/*/tsconfig.json", // Monorepo packages
150
+ "tsconfig.json",
151
+ "apps/*/tsconfig.json",
152
+ "packages/*/tsconfig.json",
118
153
  ],
119
154
  },
120
155
  },
156
+ // react.version — supplies React version to eslint-plugin-react for version-aware rules.
157
+ // detect: read version from installed `react` package instead of hard-coding.
158
+ // https://github.com/jsx-eslint/eslint-plugin-react#configuration
121
159
  react: {
122
160
  version: "detect",
123
161
  },
@@ -1 +1 @@
1
- {"version":3,"file":"reactRouterExceptions.d.ts","sourceRoot":"","sources":["../../rules/reactRouterExceptions.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;CAoBT,CAAC"}
1
+ {"version":3,"file":"reactRouterExceptions.d.ts","sourceRoot":"","sources":["../../rules/reactRouterExceptions.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;CAST,CAAC"}
@@ -10,21 +10,10 @@
10
10
  export const reactRouterExceptions = {
11
11
  files: ["**/root.tsx", "**/*.route.tsx"],
12
12
  rules: {
13
- // Allow arrow functions for React Router 7 typed exports
14
- // React Router 7 uses patterns like:
15
- // export const links: Route.LinksFunction = () => [...]
16
- // export const meta: Route.MetaFunction = () => ({ ... })
17
- // export const loader: Route.LoaderFunction = async () => { ... }
18
- //
19
- // These MUST be arrow functions or function expressions because:
20
- // 1. They require type annotations (Route.LinksFunction, etc.)
21
- // 2. TypeScript doesn't allow type annotations on function declarations
22
- // 3. The framework expects these specific export patterns
23
- //
24
- // The allowArrowFunctions option permits arrow functions in variable
25
- // declarations while still enforcing function declarations elsewhere
26
- //
13
+ // func-style requires `function foo() {}` over `const foo = function () {}` / arrows.
14
+ // Error + declaration + allowArrowFunctions: RR7 typed exports need annotated arrow/const patterns.
27
15
  // See: https://github.com/RobEasthope/protomolecule/issues/323
16
+ // https://eslint.org/docs/latest/rules/func-style
28
17
  "func-style": ["error", "declaration", { allowArrowFunctions: true }],
29
18
  },
30
19
  };
@@ -6,7 +6,7 @@
6
6
  * Combined Sanity ESLint configuration. Exports an array of two configs
7
7
  * documented inline above: schema property ordering for `*.schema.ts` (a
8
8
  * perfectionist `sort-objects` rule with custom groups so identity → fields
9
- * → behavior → validation appear in a deterministic, readable order) and
9
+ * → behaviour → validation appear in a deterministic, readable order) and
10
10
  * structure-file exceptions (allows the `S => S.list()` arrow-function
11
11
  * pattern and the canonical single-letter `S` parameter that Sanity's docs
12
12
  * universally use for the StructureBuilder).
@@ -1 +1 @@
1
- {"version":3,"file":"sanity.d.ts","sourceRoot":"","sources":["../../rules/sanity.ts"],"names":[],"mappings":"AAkIA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;IAAkD,CAAC"}
1
+ {"version":3,"file":"sanity.d.ts","sourceRoot":"","sources":["../../rules/sanity.ts"],"names":[],"mappings":"AA6IA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;IAAkD,CAAC"}
@@ -7,8 +7,8 @@
7
7
  * Property ordering follows a logical grouping:
8
8
  * 1. Identity: name, title, type, icon
9
9
  * 2. Fields: fields (placed early so document content stays visually prominent)
10
- * 3. Organization: fieldset, group, groups, fieldsets
11
- * 4. Behavior: hidden, readOnly
10
+ * 3. Organisation: fieldset, group, groups, fieldsets
11
+ * 4. Behaviour: hidden, readOnly
12
12
  * 5. Type-specific: options, rows, to, of, marks, styles
13
13
  * 6. Content defaults: initialValue, description
14
14
  * 7. Validation: validation
@@ -19,6 +19,9 @@
19
19
  const sanitySchemaPropertyOrdering = {
20
20
  files: ["**/*.schema.ts"],
21
21
  rules: {
22
+ // perfectionist/sort-objects — enforces consistent ordering of object keys/properties.
23
+ // Error with custom groups: Sanity defineField/defineType objects follow identity → fields → validation order.
24
+ // https://perfectionist.dev/rules/sort-objects
22
25
  "perfectionist/sort-objects": [
23
26
  "error",
24
27
  {
@@ -30,12 +33,12 @@ const sanitySchemaPropertyOrdering = {
30
33
  { elementNamePattern: "^icon$", groupName: "icon" },
31
34
  // 2. Fields array (placed early so the schema's content stays visually prominent)
32
35
  { elementNamePattern: "^fields$", groupName: "fields" },
33
- // 3. Organization - where does it go?
36
+ // 3. Organisation - where does it go?
34
37
  { elementNamePattern: "^fieldset$", groupName: "fieldset" },
35
38
  { elementNamePattern: "^group$", groupName: "group" },
36
39
  { elementNamePattern: "^groups$", groupName: "groups" },
37
40
  { elementNamePattern: "^fieldsets$", groupName: "fieldsets" },
38
- // 4. Behavior - how does it behave?
41
+ // 4. Behaviour - how does it behave?
39
42
  { elementNamePattern: "^hidden$", groupName: "hidden" },
40
43
  { elementNamePattern: "^readOnly$", groupName: "readOnly" },
41
44
  // 5. Type-specific options
@@ -62,12 +65,12 @@ const sanitySchemaPropertyOrdering = {
62
65
  "icon",
63
66
  // Fields
64
67
  "fields",
65
- // Organization
68
+ // Organisation
66
69
  "fieldset",
67
70
  "group",
68
71
  "groups",
69
72
  "fieldsets",
70
- // Behavior
73
+ // Behaviour
71
74
  "hidden",
72
75
  "readOnly",
73
76
  // Type-specific
@@ -112,7 +115,15 @@ const sanitySchemaPropertyOrdering = {
112
115
  const sanityStructure = {
113
116
  files: ["**/sanity.structure.ts", "**/deskStructure.ts"],
114
117
  rules: {
118
+ // func-style — requires `function foo() {}` over `const foo = function () {}` / arrows.
119
+ // Off: Sanity structure resolvers use `export const structure = (S) => …` arrow pattern.
120
+ // See: https://github.com/RobEasthope/protomolecule/issues/365
121
+ // https://eslint.org/docs/latest/rules/func-style
115
122
  "func-style": "off",
123
+ // id-length — enforces minimum identifier length (flags single-letter names).
124
+ // Off: Sanity docs universally use `S` for the StructureBuilder parameter.
125
+ // See: https://github.com/RobEasthope/protomolecule/issues/365
126
+ // https://eslint.org/docs/latest/rules/id-length
116
127
  "id-length": "off",
117
128
  },
118
129
  };
@@ -124,7 +135,7 @@ const sanityStructure = {
124
135
  * Combined Sanity ESLint configuration. Exports an array of two configs
125
136
  * documented inline above: schema property ordering for `*.schema.ts` (a
126
137
  * perfectionist `sort-objects` rule with custom groups so identity → fields
127
- * → behavior → validation appear in a deterministic, readable order) and
138
+ * → behaviour → validation appear in a deterministic, readable order) and
128
139
  * structure-file exceptions (allows the `S => S.list()` arrow-function
129
140
  * pattern and the canonical single-letter `S` parameter that Sanity's docs
130
141
  * universally use for the StructureBuilder).
@@ -1 +1 @@
1
- {"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../../rules/storybook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MASN,CAAC"}
1
+ {"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../../rules/storybook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAaN,CAAC"}
@@ -13,9 +13,13 @@ export const storybook = {
13
13
  files: ["**/*.stories.ts", "**/*.stories.tsx"],
14
14
  ignores: ["**/storybook-static/**/*"],
15
15
  rules: {
16
+ // canonical/filename-match-exported — requires default export name to match the filename.
17
+ // Off: stories are named `Component.stories.tsx`, not after the default export symbol.
18
+ // https://github.com/gajus/eslint-plugin-canonical#rules
16
19
  "canonical/filename-match-exported": "off",
17
- // Disable type-aware linting for Storybook files excluded from tsconfig
18
- // This keeps syntax-based rules active while avoiding project reference errors
20
+ // typescript-eslint disableTypeChecked turns off rules that need type information.
21
+ // Spread: story files are often excluded from tsconfig; avoids "not in project" errors.
22
+ // https://typescript-eslint.io/users/configs#disable-type-checked
19
23
  ...tseslint.configs.disableTypeChecked.rules,
20
24
  },
21
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"tableComponents.d.ts","sourceRoot":"","sources":["../../rules/tableComponents.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe;;;;;CAKH,CAAC"}
1
+ {"version":3,"file":"tableComponents.d.ts","sourceRoot":"","sources":["../../rules/tableComponents.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe;;;;;CAQH,CAAC"}
@@ -16,6 +16,9 @@
16
16
  export const tableComponents = {
17
17
  files: ["**/*Table.tsx"],
18
18
  rules: {
19
+ // react/no-unstable-nested-components — forbids defining components inside render (re-mount risk).
20
+ // Off in *Table.tsx: TanStack/Refine column cell renderers are inline by API; defs are memoised.
21
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
19
22
  "react/no-unstable-nested-components": "off",
20
23
  },
21
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"testFiles.d.ts","sourceRoot":"","sources":["../../rules/testFiles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAiCG,CAAC"}
1
+ {"version":3,"file":"testFiles.d.ts","sourceRoot":"","sources":["../../rules/testFiles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAgCG,CAAC"}
@@ -18,24 +18,26 @@ export const testFiles = {
18
18
  "**/*.test.{ts,tsx,js,jsx}",
19
19
  "**/*.spec.{ts,tsx,js,jsx}",
20
20
  "**/__tests__/**/*.{ts,tsx,js,jsx}",
21
- // Test setup files - specific framework names to avoid false positives
22
21
  "**/{vitest,jest,playwright,test}.setup.{ts,js}",
23
- // Setup files in test directories
24
22
  "**/__tests__/**/*.setup.{ts,js}",
25
23
  "**/tests/**/*.setup.{ts,js}",
26
24
  ],
27
25
  rules: {
28
- // Relax TypeScript strict rules for test files where `any` is acceptable
29
- // for testing type validation and error handling
26
+ // @typescript-eslint/no-explicit-any disallows the `any` type.
27
+ // Warn in tests: fixtures and error-path tests often need `any` for edge-case coverage.
28
+ // https://typescript-eslint.io/rules/no-explicit-any
30
29
  "@typescript-eslint/no-explicit-any": "warn",
31
- // Allow non-null assertions in test files where preconditions are asserted
32
- // and the test would fail anyway if the assumption is wrong
30
+ // @typescript-eslint/no-non-null-assertion disallows postfix `!` non-null assertions.
31
+ // Warn in tests: preconditions are often asserted; failure surfaces as a test failure anyway.
32
+ // https://typescript-eslint.io/rules/no-non-null-assertion
33
33
  "@typescript-eslint/no-non-null-assertion": "warn",
34
- // Vitest setup files use `/// <reference types="..." />` to augment global
35
- // types (e.g. `@testing-library/jest-dom`); the rule is a false positive there.
34
+ // @typescript-eslint/triple-slash-reference disallows `/// <reference />` directives.
35
+ // Off in setup files: Vitest/Jest setups use triple-slash to augment global types.
36
+ // https://typescript-eslint.io/rules/triple-slash-reference
36
37
  "@typescript-eslint/triple-slash-reference": "off",
37
- // Allow devDependencies in test files and setup files
38
- // Test dependencies should be in devDependencies, not dependencies
38
+ // import/no-extraneous-dependencies forbids importing packages not listed in package.json.
39
+ // Error + devDependencies true: test-only packages belong in devDependencies, not dependencies.
40
+ // https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-extraneous-dependencies.md
39
41
  "import/no-extraneous-dependencies": [
40
42
  "error",
41
43
  {
@@ -1 +1 @@
1
- {"version":3,"file":"typescriptOverrides.d.ts","sourceRoot":"","sources":["../../rules/typescriptOverrides.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;CAMP,CAAC"}
1
+ {"version":3,"file":"typescriptOverrides.d.ts","sourceRoot":"","sources":["../../rules/typescriptOverrides.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;CAYP,CAAC"}
@@ -8,7 +8,13 @@
8
8
  export const typescriptOverrides = {
9
9
  files: ["**/*.{ts,tsx}"],
10
10
  rules: {
11
+ // react/no-unused-prop-types — flags PropTypes declared but never used in the component.
12
+ // Off under TS: prop types are checked by TypeScript, not runtime PropTypes.
13
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
11
14
  "react/no-unused-prop-types": "off",
15
+ // react/prop-types — requires React components to declare PropTypes for props.
16
+ // Off under TS: interfaces/types replace PropTypes for compile-time checking.
17
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md
12
18
  "react/prop-types": "off",
13
19
  },
14
20
  };