@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.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/infrastructure/scripts/add-links-changelog.d.ts +12 -0
- package/dist/infrastructure/scripts/add-links-changelog.d.ts.map +1 -0
- package/dist/infrastructure/scripts/add-links-changelog.js +56 -0
- package/dist/infrastructure/scripts/enrich-changelog.d.ts +26 -0
- package/dist/infrastructure/scripts/enrich-changelog.d.ts.map +1 -0
- package/dist/infrastructure/scripts/enrich-changelog.js +60 -0
- package/dist/infrastructure/scripts/finalise-changelog.d.ts +26 -0
- package/dist/infrastructure/scripts/finalise-changelog.d.ts.map +1 -0
- package/dist/infrastructure/scripts/finalise-changelog.js +152 -0
- package/dist/infrastructure/scripts/stamp-changelog-version.d.ts +10 -0
- package/dist/infrastructure/scripts/stamp-changelog-version.d.ts.map +1 -0
- package/dist/infrastructure/scripts/stamp-changelog-version.js +35 -0
- package/dist/infrastructure/scripts/validate-changelog.d.ts +7 -0
- package/dist/infrastructure/scripts/validate-changelog.d.ts.map +1 -0
- package/dist/infrastructure/scripts/validate-changelog.js +216 -0
- package/dist/rules/astro.d.ts.map +1 -1
- package/dist/rules/astro.js +9 -6
- package/dist/rules/commonjs.d.ts +2 -1
- package/dist/rules/commonjs.d.ts.map +1 -1
- package/dist/rules/commonjs.js +2 -1
- package/dist/rules/complexity.d.ts.map +1 -1
- package/dist/rules/complexity.js +3 -0
- package/dist/rules/e2e.d.ts.map +1 -1
- package/dist/rules/e2e.js +3 -0
- package/dist/rules/frameworkRouting.d.ts.map +1 -1
- package/dist/rules/frameworkRouting.js +4 -3
- package/dist/rules/ignoredFileAndFolders.d.ts +1 -0
- package/dist/rules/ignoredFileAndFolders.d.ts.map +1 -1
- package/dist/rules/ignoredFileAndFolders.js +1 -0
- package/dist/rules/packageJson.d.ts.map +1 -1
- package/dist/rules/packageJson.js +3 -0
- package/dist/rules/preferences.d.ts.map +1 -1
- package/dist/rules/preferences.js +67 -29
- package/dist/rules/reactRouterExceptions.d.ts.map +1 -1
- package/dist/rules/reactRouterExceptions.js +3 -14
- package/dist/rules/sanity.d.ts +1 -1
- package/dist/rules/sanity.d.ts.map +1 -1
- package/dist/rules/sanity.js +18 -7
- package/dist/rules/storybook.d.ts.map +1 -1
- package/dist/rules/storybook.js +6 -2
- package/dist/rules/tableComponents.d.ts.map +1 -1
- package/dist/rules/tableComponents.js +3 -0
- package/dist/rules/testFiles.d.ts.map +1 -1
- package/dist/rules/testFiles.js +12 -10
- package/dist/rules/typescriptOverrides.d.ts.map +1 -1
- package/dist/rules/typescriptOverrides.js +6 -0
- package/package.json +12 -10
- package/dist/infrastructure/scripts/retitle-release-pr.d.ts +0 -11
- package/dist/infrastructure/scripts/retitle-release-pr.d.ts.map +0 -1
- package/dist/infrastructure/scripts/retitle-release-pr.js +0 -50
package/dist/rules/astro.js
CHANGED
|
@@ -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
|
-
//
|
|
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
|
},
|
package/dist/rules/commonjs.d.ts
CHANGED
|
@@ -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
|
|
1
|
+
{"version":3,"file":"commonjs.d.ts","sourceRoot":"","sources":["../../rules/commonjs.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcI,CAAC"}
|
package/dist/rules/commonjs.js
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/rules/complexity.js
CHANGED
|
@@ -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
|
},
|
package/dist/rules/e2e.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../rules/e2e.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,GAAG;;;;;
|
|
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;;;;;
|
|
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
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
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
|
|
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;;;;;
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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
|
-
//
|
|
28
|
-
//
|
|
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
|
-
//
|
|
33
|
-
//
|
|
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
|
-
//
|
|
38
|
-
//
|
|
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
|
-
//
|
|
42
|
-
//
|
|
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
|
-
//
|
|
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
|
-
//
|
|
81
|
-
// e.g
|
|
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
|
-
//
|
|
104
|
-
//
|
|
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",
|
|
116
|
-
"apps/*/tsconfig.json",
|
|
117
|
-
"packages/*/tsconfig.json",
|
|
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;;;;;;;
|
|
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
|
-
//
|
|
14
|
-
//
|
|
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
|
};
|
package/dist/rules/sanity.d.ts
CHANGED
|
@@ -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
|
-
* →
|
|
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":"
|
|
1
|
+
{"version":3,"file":"sanity.d.ts","sourceRoot":"","sources":["../../rules/sanity.ts"],"names":[],"mappings":"AA6IA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;IAAkD,CAAC"}
|
package/dist/rules/sanity.js
CHANGED
|
@@ -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.
|
|
11
|
-
* 4.
|
|
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.
|
|
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.
|
|
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
|
-
//
|
|
68
|
+
// Organisation
|
|
66
69
|
"fieldset",
|
|
67
70
|
"group",
|
|
68
71
|
"groups",
|
|
69
72
|
"fieldsets",
|
|
70
|
-
//
|
|
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
|
-
* →
|
|
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,
|
|
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"}
|
package/dist/rules/storybook.js
CHANGED
|
@@ -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
|
-
//
|
|
18
|
-
//
|
|
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;;;;;
|
|
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;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"testFiles.d.ts","sourceRoot":"","sources":["../../rules/testFiles.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CAgCG,CAAC"}
|
package/dist/rules/testFiles.js
CHANGED
|
@@ -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
|
-
//
|
|
29
|
-
//
|
|
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
|
-
//
|
|
32
|
-
//
|
|
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
|
-
//
|
|
35
|
-
//
|
|
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
|
-
//
|
|
38
|
-
//
|
|
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;;;;;;
|
|
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
|
};
|