@acme-skunkworks/eslint-config 1.0.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/LICENSE +21 -0
- package/README.md +142 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/rules/astro.d.ts +3 -0
- package/dist/rules/astro.d.ts.map +1 -0
- package/dist/rules/astro.js +21 -0
- package/dist/rules/commonjs.d.ts +155 -0
- package/dist/rules/commonjs.d.ts.map +1 -0
- package/dist/rules/commonjs.js +16 -0
- package/dist/rules/complexity.d.ts +16 -0
- package/dist/rules/complexity.d.ts.map +1 -0
- package/dist/rules/complexity.js +21 -0
- package/dist/rules/e2e.d.ts +18 -0
- package/dist/rules/e2e.d.ts.map +1 -0
- package/dist/rules/e2e.js +17 -0
- package/dist/rules/frameworkRouting.d.ts +18 -0
- package/dist/rules/frameworkRouting.d.ts.map +1 -0
- package/dist/rules/frameworkRouting.js +26 -0
- package/dist/rules/ignoredFileAndFolders.d.ts +4 -0
- package/dist/rules/ignoredFileAndFolders.d.ts.map +1 -0
- package/dist/rules/ignoredFileAndFolders.js +20 -0
- package/dist/rules/packageJson.d.ts +7 -0
- package/dist/rules/packageJson.d.ts.map +1 -0
- package/dist/rules/packageJson.js +6 -0
- package/dist/rules/preferences.d.ts +61 -0
- package/dist/rules/preferences.d.ts.map +1 -0
- package/dist/rules/preferences.js +111 -0
- package/dist/rules/reactRouterExceptions.d.ts +9 -0
- package/dist/rules/reactRouterExceptions.d.ts.map +1 -0
- package/dist/rules/reactRouterExceptions.js +21 -0
- package/dist/rules/sanity.d.ts +27 -0
- package/dist/rules/sanity.d.ts.map +1 -0
- package/dist/rules/sanity.js +126 -0
- package/dist/rules/storybook.d.ts +3 -0
- package/dist/rules/storybook.d.ts.map +1 -0
- package/dist/rules/storybook.js +11 -0
- package/dist/rules/tableComponents.d.ts +19 -0
- package/dist/rules/tableComponents.d.ts.map +1 -0
- package/dist/rules/tableComponents.js +18 -0
- package/dist/rules/testFiles.d.ts +12 -0
- package/dist/rules/testFiles.d.ts.map +1 -0
- package/dist/rules/testFiles.js +31 -0
- package/dist/rules/typescriptOverrides.d.ts +8 -0
- package/dist/rules/typescriptOverrides.d.ts.map +1 -0
- package/dist/rules/typescriptOverrides.js +7 -0
- package/package.json +95 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rob Easthope
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# @acme-skunkworks/eslint-config
|
|
2
|
+
|
|
3
|
+
Shared ESLint v9 configuration with TypeScript and React support, composed from named-export presets.
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @acme-skunkworks/eslint-config eslint prettier
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Every ESLint plugin used by the config ships as a regular dependency — you don't install plugins separately. `eslint` and `prettier` are peer dependencies.
|
|
12
|
+
|
|
13
|
+
## 🚀 Usage
|
|
14
|
+
|
|
15
|
+
The package exports presets as named exports. Compose them in your `eslint.config.js`:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { base, typescript, frameworkRouting } from "@acme-skunkworks/eslint-config";
|
|
19
|
+
|
|
20
|
+
export default [
|
|
21
|
+
...base,
|
|
22
|
+
typescript,
|
|
23
|
+
...frameworkRouting,
|
|
24
|
+
// your overrides last so they win
|
|
25
|
+
{
|
|
26
|
+
rules: {
|
|
27
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Pull in the presets relevant to your project:
|
|
34
|
+
|
|
35
|
+
| Export | What it covers |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `base` | Plugin-alias hack + global ignores + the canonical baseline + packageJson lint config + commonjs file overrides + the big preferences block (top-level type imports, `func-style: declaration`, prettier integration, import resolver, `no-console` warn, etc.). The "you almost always want this" stack. |
|
|
38
|
+
| `typescript` | Overrides for `**/*.{ts,tsx}` (disables `react/no-unused-prop-types` and `react/prop-types`). |
|
|
39
|
+
| `frameworkRouting` | Disables `canonical/filename-match-exported` for routing dirs (`routes/**`, `app/**`, `pages/**`, `src/routes/**`, `src/pages/**`); re-allows arrow functions on `root.tsx` / `*.route.tsx`. Order matters — must spread **after** `base`. |
|
|
40
|
+
| `astro` | `eslint-plugin-astro/flat/recommended` + Astro-specific overrides. Pull in for Astro projects. |
|
|
41
|
+
| `sanity` | Schema property ordering for `*.schema.ts` and structure-file exceptions. Pull in for projects using Sanity Studio. |
|
|
42
|
+
| `testing` | Relaxes strict TypeScript rules and devDependencies imports for `**/*.{test,spec}.*`, `__tests__/**`, and setup files. |
|
|
43
|
+
| `storybook` | Overrides for `**/*.stories.{ts,tsx}`. |
|
|
44
|
+
| `complexity` | Raises cyclomatic complexity threshold to 40 for `**/scripts/**` (orchestration scripts run linearly). Opt-in. |
|
|
45
|
+
| `e2e` | Disables `react-hooks/rules-of-hooks` for `**/e2e/**` (Playwright `test.extend` callbacks are false positives). Opt-in. |
|
|
46
|
+
| `tableComponents` | Disables `react/no-unstable-nested-components` for `**/*Table.tsx` (TanStack Table / Refine column-cell renderers). Opt-in. |
|
|
47
|
+
|
|
48
|
+
> **Note:** Requires ESLint v9+ with flat config. Node 22+.
|
|
49
|
+
|
|
50
|
+
## 🔄 Migrating from `@robeasthope/eslint-config`
|
|
51
|
+
|
|
52
|
+
This package was previously published as `@robeasthope/eslint-config` from the [`RobEasthope/protomolecule`](https://github.com/RobEasthope/protomolecule) monorepo (versions up to and including v6.2.1). It now ships from this standalone repo under the `@acme-skunkworks` scope, with a named-export composition pattern.
|
|
53
|
+
|
|
54
|
+
### Step 1: rename the dep
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pnpm remove @robeasthope/eslint-config
|
|
58
|
+
pnpm add -D @acme-skunkworks/eslint-config
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Step 2: switch to named exports
|
|
62
|
+
|
|
63
|
+
The default export still works during the migration window, but is **deprecated** and will be removed in a future major:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
// Old (still works in v7, deprecated)
|
|
67
|
+
import eslintConfig from "@acme-skunkworks/eslint-config";
|
|
68
|
+
export default [...eslintConfig];
|
|
69
|
+
|
|
70
|
+
// New (preferred — pull in only what you need)
|
|
71
|
+
import { base, typescript, frameworkRouting } from "@acme-skunkworks/eslint-config";
|
|
72
|
+
export default [...base, typescript, ...frameworkRouting];
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If your project was a Sanity / Storybook / Astro consumer, opt-in to those presets explicitly. The default export bundled all of them; the new shape makes the dependencies explicit.
|
|
76
|
+
|
|
77
|
+
### What's new in v7
|
|
78
|
+
|
|
79
|
+
- **Tempest fold-in.** Plugin versions bumped to current; `complexity`, `e2e`, and `tableComponents` are new opt-in presets ported from Tempest. See `MIGRATION_FROM_PROTOMOLECULE.md` for the per-preset diff.
|
|
80
|
+
- **Named-export composition.** Each preset is independently importable; consumers compose what they need.
|
|
81
|
+
- **`prettier` is now a `peerDependency`.** Was already a transitive dep via `eslint-plugin-prettier`; this just makes the contract explicit.
|
|
82
|
+
|
|
83
|
+
For older breaking-change history (v4 → v5 plugin bundling, v5 → v6 top-level type imports) see the original [protomolecule changelog](https://github.com/RobEasthope/protomolecule/blob/main/packages/eslint-config/CHANGELOG.md).
|
|
84
|
+
|
|
85
|
+
## ✨ Features
|
|
86
|
+
|
|
87
|
+
- **TypeScript** — full TypeScript linting via `typescript-eslint` v8.
|
|
88
|
+
- **React** — React 19 compatible rules from canonical-auto.
|
|
89
|
+
- **React Router 7 compatible** — top-level type imports, `func-style: declaration` with framework-aware exceptions for typed exports on `root.tsx` / `*.route.tsx`.
|
|
90
|
+
- **Astro** — opt-in preset.
|
|
91
|
+
- **Sanity** — opt-in preset for schema property ordering and structure-file exceptions.
|
|
92
|
+
- **Modern JavaScript** — ES2022+, Prettier integration, accessibility checks.
|
|
93
|
+
|
|
94
|
+
## 🛠️ Customisation
|
|
95
|
+
|
|
96
|
+
Override any rule from your local config — last config wins in flat config:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
import { base, typescript } from "@acme-skunkworks/eslint-config";
|
|
100
|
+
|
|
101
|
+
export default [
|
|
102
|
+
...base,
|
|
103
|
+
typescript,
|
|
104
|
+
{
|
|
105
|
+
rules: {
|
|
106
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
107
|
+
"react/prop-types": "off",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Add additional plugins by configuring them directly:
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
import { base, typescript } from "@acme-skunkworks/eslint-config";
|
|
117
|
+
import pluginReact from "eslint-plugin-react";
|
|
118
|
+
|
|
119
|
+
export default [
|
|
120
|
+
...base,
|
|
121
|
+
typescript,
|
|
122
|
+
{
|
|
123
|
+
plugins: { react: pluginReact },
|
|
124
|
+
rules: { "react/jsx-uses-react": "error" },
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 🔧 Development
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pnpm install # install deps
|
|
133
|
+
pnpm run build # tsc → dist/
|
|
134
|
+
pnpm lint # lint this package's own source
|
|
135
|
+
pnpm lint:fix # auto-fix
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 📄 License
|
|
139
|
+
|
|
140
|
+
MIT License — see [LICENSE](LICENSE).
|
|
141
|
+
|
|
142
|
+
This software is provided "as is", without warranty of any kind. Use at your own risk.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
/**
|
|
3
|
+
* Base preset — the "you almost always want this" stack:
|
|
4
|
+
* plugin-alias hack, global ignores, the canonical baseline, packageJson
|
|
5
|
+
* lint config, commonjs file overrides, and the big preferences block
|
|
6
|
+
* (top-level type imports, func-style, prettier, import resolver, etc.).
|
|
7
|
+
*/
|
|
8
|
+
export declare const base: Linter.Config[];
|
|
9
|
+
/**
|
|
10
|
+
* TypeScript-specific overrides for `**\/*.{ts,tsx}` files.
|
|
11
|
+
*/
|
|
12
|
+
export declare const typescript: Linter.Config;
|
|
13
|
+
/**
|
|
14
|
+
* Framework-routing preset for file-routed frameworks (Next.js, React Router 7,
|
|
15
|
+
* Remix, SvelteKit, Astro, Nuxt). Disables `canonical/filename-match-exported`
|
|
16
|
+
* for routing directories and re-allows arrow functions on `root.tsx` /
|
|
17
|
+
* `*.route.tsx` for typed-export patterns.
|
|
18
|
+
*
|
|
19
|
+
* Order matters: `reactRouterExceptions` MUST come after `preferences` (which
|
|
20
|
+
* `base` already includes) so its `func-style` override wins.
|
|
21
|
+
*/
|
|
22
|
+
export declare const frameworkRouting: Linter.Config[];
|
|
23
|
+
/**
|
|
24
|
+
* Test-file overrides for `*.test.*`, `*.spec.*`, `__tests__/**`, setup files.
|
|
25
|
+
*/
|
|
26
|
+
export declare const testing: Linter.Config;
|
|
27
|
+
export { astro } from "./rules/astro.js";
|
|
28
|
+
export { complexity } from "./rules/complexity.js";
|
|
29
|
+
export { e2e } from "./rules/e2e.js";
|
|
30
|
+
export { sanity } from "./rules/sanity.js";
|
|
31
|
+
export { storybook } from "./rules/storybook.js";
|
|
32
|
+
export { tableComponents } from "./rules/tableComponents.js";
|
|
33
|
+
/**
|
|
34
|
+
* Back-compat default export — preserves the v6.x composition exactly so
|
|
35
|
+
* existing consumers can `import config from "@acme-skunkworks/eslint-config"`
|
|
36
|
+
* during their migration window.
|
|
37
|
+
*
|
|
38
|
+
* **Deprecated**: prefer named imports per the README's "Migrating from
|
|
39
|
+
* `@robeasthope/eslint-config`" section. The default export will be removed
|
|
40
|
+
* in a future major.
|
|
41
|
+
*/
|
|
42
|
+
declare const defaultConfig: Linter.Config[];
|
|
43
|
+
export default defaultConfig;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAerC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,EAO/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAA4B,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAG3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAkB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EASjC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* eslint-disable canonical/filename-match-exported */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
import { astro } from "./rules/astro.js";
|
|
4
|
+
import { commonjs } from "./rules/commonjs.js";
|
|
5
|
+
import { frameworkRouting as frameworkRoutingRule } from "./rules/frameworkRouting.js";
|
|
6
|
+
import { ignoredFileAndFolders } from "./rules/ignoredFileAndFolders.js";
|
|
7
|
+
import { packageJson } from "./rules/packageJson.js";
|
|
8
|
+
import { preferences } from "./rules/preferences.js";
|
|
9
|
+
import { reactRouterExceptions } from "./rules/reactRouterExceptions.js";
|
|
10
|
+
import { sanity } from "./rules/sanity.js";
|
|
11
|
+
import { storybook } from "./rules/storybook.js";
|
|
12
|
+
import { testFiles } from "./rules/testFiles.js";
|
|
13
|
+
import { typescriptOverrides } from "./rules/typescriptOverrides.js";
|
|
14
|
+
import eslintConfigCanonicalAuto from "eslint-config-canonical/auto";
|
|
15
|
+
import pluginImportX from "eslint-plugin-import-x";
|
|
16
|
+
// Plugin aliasing for eslint-config-canonical compatibility.
|
|
17
|
+
// Canonical references "import" but the package is "eslint-plugin-import-x".
|
|
18
|
+
// Register under both names so canonical's rules resolve and modern code works.
|
|
19
|
+
// See: https://github.com/RobEasthope/protomolecule/issues/259
|
|
20
|
+
const importXAlias = {
|
|
21
|
+
plugins: {
|
|
22
|
+
import: pluginImportX,
|
|
23
|
+
"import-x": pluginImportX,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Base preset — the "you almost always want this" stack:
|
|
28
|
+
* plugin-alias hack, global ignores, the canonical baseline, packageJson
|
|
29
|
+
* lint config, commonjs file overrides, and the big preferences block
|
|
30
|
+
* (top-level type imports, func-style, prettier, import resolver, etc.).
|
|
31
|
+
*/
|
|
32
|
+
export const base = [
|
|
33
|
+
importXAlias,
|
|
34
|
+
ignoredFileAndFolders,
|
|
35
|
+
...eslintConfigCanonicalAuto,
|
|
36
|
+
packageJson,
|
|
37
|
+
commonjs,
|
|
38
|
+
preferences,
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* TypeScript-specific overrides for `**\/*.{ts,tsx}` files.
|
|
42
|
+
*/
|
|
43
|
+
export const typescript = typescriptOverrides;
|
|
44
|
+
/**
|
|
45
|
+
* Framework-routing preset for file-routed frameworks (Next.js, React Router 7,
|
|
46
|
+
* Remix, SvelteKit, Astro, Nuxt). Disables `canonical/filename-match-exported`
|
|
47
|
+
* for routing directories and re-allows arrow functions on `root.tsx` /
|
|
48
|
+
* `*.route.tsx` for typed-export patterns.
|
|
49
|
+
*
|
|
50
|
+
* Order matters: `reactRouterExceptions` MUST come after `preferences` (which
|
|
51
|
+
* `base` already includes) so its `func-style` override wins.
|
|
52
|
+
*/
|
|
53
|
+
export const frameworkRouting = [
|
|
54
|
+
frameworkRoutingRule,
|
|
55
|
+
reactRouterExceptions,
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* Test-file overrides for `*.test.*`, `*.spec.*`, `__tests__/**`, setup files.
|
|
59
|
+
*/
|
|
60
|
+
export const testing = testFiles;
|
|
61
|
+
export { astro } from "./rules/astro.js";
|
|
62
|
+
export { complexity } from "./rules/complexity.js";
|
|
63
|
+
export { e2e } from "./rules/e2e.js";
|
|
64
|
+
export { sanity } from "./rules/sanity.js";
|
|
65
|
+
export { storybook } from "./rules/storybook.js";
|
|
66
|
+
export { tableComponents } from "./rules/tableComponents.js";
|
|
67
|
+
/**
|
|
68
|
+
* Back-compat default export — preserves the v6.x composition exactly so
|
|
69
|
+
* existing consumers can `import config from "@acme-skunkworks/eslint-config"`
|
|
70
|
+
* during their migration window.
|
|
71
|
+
*
|
|
72
|
+
* **Deprecated**: prefer named imports per the README's "Migrating from
|
|
73
|
+
* `@robeasthope/eslint-config`" section. The default export will be removed
|
|
74
|
+
* in a future major.
|
|
75
|
+
*/
|
|
76
|
+
const defaultConfig = [
|
|
77
|
+
...base,
|
|
78
|
+
...astro,
|
|
79
|
+
testFiles,
|
|
80
|
+
storybook,
|
|
81
|
+
typescriptOverrides,
|
|
82
|
+
reactRouterExceptions,
|
|
83
|
+
frameworkRoutingRule,
|
|
84
|
+
...sanity,
|
|
85
|
+
];
|
|
86
|
+
export default defaultConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../../rules/astro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAmBhC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { configs } from "eslint-plugin-astro";
|
|
2
|
+
export const astro = [
|
|
3
|
+
...configs["flat/recommended"],
|
|
4
|
+
{
|
|
5
|
+
files: ["**/*.astro"],
|
|
6
|
+
rules: {
|
|
7
|
+
"astro/no-set-html-directive": "error",
|
|
8
|
+
// Ignore imports that ESLint's static resolver can't handle in Astro files
|
|
9
|
+
"import/no-unresolved": [
|
|
10
|
+
"error",
|
|
11
|
+
{
|
|
12
|
+
ignore: [
|
|
13
|
+
"^astro:", // Astro virtual modules (astro:content, astro:assets, etc.)
|
|
14
|
+
"^@/", // Path aliases defined in tsconfig (e.g., @/components)
|
|
15
|
+
"\\.astro$", // .astro file imports (Astro's custom file format)
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
];
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export declare const commonjs: {
|
|
2
|
+
files: string[];
|
|
3
|
+
ignores: string[];
|
|
4
|
+
languageOptions: {
|
|
5
|
+
globals: {
|
|
6
|
+
AggregateError: false;
|
|
7
|
+
Array: false;
|
|
8
|
+
ArrayBuffer: false;
|
|
9
|
+
Atomics: false;
|
|
10
|
+
BigInt: false;
|
|
11
|
+
BigInt64Array: false;
|
|
12
|
+
BigUint64Array: false;
|
|
13
|
+
Boolean: false;
|
|
14
|
+
DataView: false;
|
|
15
|
+
Date: false;
|
|
16
|
+
decodeURI: false;
|
|
17
|
+
decodeURIComponent: false;
|
|
18
|
+
encodeURI: false;
|
|
19
|
+
encodeURIComponent: false;
|
|
20
|
+
Error: false;
|
|
21
|
+
escape: false;
|
|
22
|
+
eval: false;
|
|
23
|
+
EvalError: false;
|
|
24
|
+
FinalizationRegistry: false;
|
|
25
|
+
Float32Array: false;
|
|
26
|
+
Float64Array: false;
|
|
27
|
+
Function: false;
|
|
28
|
+
globalThis: false;
|
|
29
|
+
Infinity: false;
|
|
30
|
+
Int16Array: false;
|
|
31
|
+
Int32Array: false;
|
|
32
|
+
Int8Array: false;
|
|
33
|
+
Intl: false;
|
|
34
|
+
isFinite: false;
|
|
35
|
+
isNaN: false;
|
|
36
|
+
JSON: false;
|
|
37
|
+
Map: false;
|
|
38
|
+
Math: false;
|
|
39
|
+
NaN: false;
|
|
40
|
+
Number: false;
|
|
41
|
+
Object: false;
|
|
42
|
+
parseFloat: false;
|
|
43
|
+
parseInt: false;
|
|
44
|
+
Promise: false;
|
|
45
|
+
Proxy: false;
|
|
46
|
+
RangeError: false;
|
|
47
|
+
ReferenceError: false;
|
|
48
|
+
Reflect: false;
|
|
49
|
+
RegExp: false;
|
|
50
|
+
Set: false;
|
|
51
|
+
SharedArrayBuffer: false;
|
|
52
|
+
String: false;
|
|
53
|
+
Symbol: false;
|
|
54
|
+
SyntaxError: false;
|
|
55
|
+
TypeError: false;
|
|
56
|
+
Uint16Array: false;
|
|
57
|
+
Uint32Array: false;
|
|
58
|
+
Uint8Array: false;
|
|
59
|
+
Uint8ClampedArray: false;
|
|
60
|
+
undefined: false;
|
|
61
|
+
unescape: false;
|
|
62
|
+
URIError: false;
|
|
63
|
+
WeakMap: false;
|
|
64
|
+
WeakRef: false;
|
|
65
|
+
WeakSet: false;
|
|
66
|
+
__dirname: false;
|
|
67
|
+
__filename: false;
|
|
68
|
+
AbortController: false;
|
|
69
|
+
AbortSignal: false;
|
|
70
|
+
AsyncDisposableStack: false;
|
|
71
|
+
atob: false;
|
|
72
|
+
Blob: false;
|
|
73
|
+
BroadcastChannel: false;
|
|
74
|
+
btoa: false;
|
|
75
|
+
Buffer: false;
|
|
76
|
+
ByteLengthQueuingStrategy: false;
|
|
77
|
+
clearImmediate: false;
|
|
78
|
+
clearInterval: false;
|
|
79
|
+
clearTimeout: false;
|
|
80
|
+
CloseEvent: false;
|
|
81
|
+
CompressionStream: false;
|
|
82
|
+
console: false;
|
|
83
|
+
CountQueuingStrategy: false;
|
|
84
|
+
crypto: false;
|
|
85
|
+
Crypto: false;
|
|
86
|
+
CryptoKey: false;
|
|
87
|
+
CustomEvent: false;
|
|
88
|
+
DecompressionStream: false;
|
|
89
|
+
DisposableStack: false;
|
|
90
|
+
DOMException: false;
|
|
91
|
+
ErrorEvent: false;
|
|
92
|
+
Event: false;
|
|
93
|
+
EventTarget: false;
|
|
94
|
+
exports: true;
|
|
95
|
+
fetch: false;
|
|
96
|
+
File: false;
|
|
97
|
+
FormData: false;
|
|
98
|
+
global: false;
|
|
99
|
+
Headers: false;
|
|
100
|
+
localStorage: false;
|
|
101
|
+
MessageChannel: false;
|
|
102
|
+
MessageEvent: false;
|
|
103
|
+
MessagePort: false;
|
|
104
|
+
module: false;
|
|
105
|
+
navigator: false;
|
|
106
|
+
Navigator: false;
|
|
107
|
+
performance: false;
|
|
108
|
+
Performance: false;
|
|
109
|
+
PerformanceEntry: false;
|
|
110
|
+
PerformanceMark: false;
|
|
111
|
+
PerformanceMeasure: false;
|
|
112
|
+
PerformanceObserver: false;
|
|
113
|
+
PerformanceObserverEntryList: false;
|
|
114
|
+
PerformanceResourceTiming: false;
|
|
115
|
+
process: false;
|
|
116
|
+
queueMicrotask: false;
|
|
117
|
+
ReadableByteStreamController: false;
|
|
118
|
+
ReadableStream: false;
|
|
119
|
+
ReadableStreamBYOBReader: false;
|
|
120
|
+
ReadableStreamBYOBRequest: false;
|
|
121
|
+
ReadableStreamDefaultController: false;
|
|
122
|
+
ReadableStreamDefaultReader: false;
|
|
123
|
+
Request: false;
|
|
124
|
+
require: false;
|
|
125
|
+
Response: false;
|
|
126
|
+
sessionStorage: false;
|
|
127
|
+
setImmediate: false;
|
|
128
|
+
setInterval: false;
|
|
129
|
+
setTimeout: false;
|
|
130
|
+
Storage: false;
|
|
131
|
+
structuredClone: false;
|
|
132
|
+
SubtleCrypto: false;
|
|
133
|
+
SuppressedError: false;
|
|
134
|
+
TextDecoder: false;
|
|
135
|
+
TextDecoderStream: false;
|
|
136
|
+
TextEncoder: false;
|
|
137
|
+
TextEncoderStream: false;
|
|
138
|
+
TransformStream: false;
|
|
139
|
+
TransformStreamDefaultController: false;
|
|
140
|
+
URL: false;
|
|
141
|
+
URLPattern: false;
|
|
142
|
+
URLSearchParams: false;
|
|
143
|
+
WebAssembly: false;
|
|
144
|
+
WebSocket: false;
|
|
145
|
+
WritableStream: false;
|
|
146
|
+
WritableStreamDefaultController: false;
|
|
147
|
+
WritableStreamDefaultWriter: false;
|
|
148
|
+
};
|
|
149
|
+
parserOptions: {
|
|
150
|
+
ecmaVersion: string;
|
|
151
|
+
};
|
|
152
|
+
sourceType: string;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=commonjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonjs.d.ts","sourceRoot":"","sources":["../../rules/commonjs.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcI,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
export const commonjs = {
|
|
3
|
+
files: ["**/*.cjs"],
|
|
4
|
+
// Exclude node_modules
|
|
5
|
+
ignores: ["**/node_modules/**"],
|
|
6
|
+
languageOptions: {
|
|
7
|
+
globals: {
|
|
8
|
+
...globals.node,
|
|
9
|
+
...globals.es2021,
|
|
10
|
+
},
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaVersion: "latest",
|
|
13
|
+
},
|
|
14
|
+
sourceType: "script",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
/**
|
|
3
|
+
* Complexity overrides for file patterns where a cyclomatic-complexity exemption
|
|
4
|
+
* is structural rather than a code smell.
|
|
5
|
+
*
|
|
6
|
+
* Currently only covers maintenance/orchestration scripts, which tend to run many
|
|
7
|
+
* steps linearly; splitting them obscures flow more than it helps. Threshold raised to 40.
|
|
8
|
+
*
|
|
9
|
+
* Consumers with their own structural-complexity hot spots (e.g. file-routed view
|
|
10
|
+
* components that mirror a sibling) can extend this preset locally.
|
|
11
|
+
*
|
|
12
|
+
* Ported from Tempest's `studioTables` + `complexity` lineage. See the eslint-config
|
|
13
|
+
* repo's `MIGRATION_FROM_PROTOMOLECULE.md` "Tempest fold-in deltas" section.
|
|
14
|
+
*/
|
|
15
|
+
export declare const complexity: Linter.Config[];
|
|
16
|
+
//# sourceMappingURL=complexity.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAOrC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Complexity overrides for file patterns where a cyclomatic-complexity exemption
|
|
3
|
+
* is structural rather than a code smell.
|
|
4
|
+
*
|
|
5
|
+
* Currently only covers maintenance/orchestration scripts, which tend to run many
|
|
6
|
+
* steps linearly; splitting them obscures flow more than it helps. Threshold raised to 40.
|
|
7
|
+
*
|
|
8
|
+
* Consumers with their own structural-complexity hot spots (e.g. file-routed view
|
|
9
|
+
* components that mirror a sibling) can extend this preset locally.
|
|
10
|
+
*
|
|
11
|
+
* Ported from Tempest's `studioTables` + `complexity` lineage. See the eslint-config
|
|
12
|
+
* repo's `MIGRATION_FROM_PROTOMOLECULE.md` "Tempest fold-in deltas" section.
|
|
13
|
+
*/
|
|
14
|
+
export const complexity = [
|
|
15
|
+
{
|
|
16
|
+
files: ["**/scripts/**/*.{ts,tsx,js,mjs}"],
|
|
17
|
+
rules: {
|
|
18
|
+
complexity: ["error", 40],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint override for Playwright end-to-end fixtures.
|
|
3
|
+
*
|
|
4
|
+
* Playwright's `test.extend()` / `test.use()` pattern involves passing fixture
|
|
5
|
+
* factories that read destructured arguments. Static analysis misreads these
|
|
6
|
+
* callbacks as React hook calls and flags them with `react-hooks/rules-of-hooks`,
|
|
7
|
+
* which is a false positive for e2e test code.
|
|
8
|
+
*
|
|
9
|
+
* Ported from Tempest. The Tempest-specific `**\/fixtures/authenticated*` glob
|
|
10
|
+
* was dropped during the fold-in to keep this preset broadly applicable.
|
|
11
|
+
*/
|
|
12
|
+
export declare const e2e: {
|
|
13
|
+
files: string[];
|
|
14
|
+
rules: {
|
|
15
|
+
"react-hooks/rules-of-hooks": "off";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=e2e.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"e2e.d.ts","sourceRoot":"","sources":["../../rules/e2e.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,GAAG;;;;;CAKS,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint override for Playwright end-to-end fixtures.
|
|
3
|
+
*
|
|
4
|
+
* Playwright's `test.extend()` / `test.use()` pattern involves passing fixture
|
|
5
|
+
* factories that read destructured arguments. Static analysis misreads these
|
|
6
|
+
* callbacks as React hook calls and flags them with `react-hooks/rules-of-hooks`,
|
|
7
|
+
* which is a false positive for e2e test code.
|
|
8
|
+
*
|
|
9
|
+
* Ported from Tempest. The Tempest-specific `**\/fixtures/authenticated*` glob
|
|
10
|
+
* was dropped during the fold-in to keep this preset broadly applicable.
|
|
11
|
+
*/
|
|
12
|
+
export const e2e = {
|
|
13
|
+
files: ["**/e2e/**/*.{ts,tsx}"],
|
|
14
|
+
rules: {
|
|
15
|
+
"react-hooks/rules-of-hooks": "off",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint configuration for framework-based file routing patterns.
|
|
3
|
+
*
|
|
4
|
+
* Modern meta-frameworks (Next.js, React Router, Remix, SvelteKit, Astro, Nuxt)
|
|
5
|
+
* use file-based routing where filenames are determined by routing conventions
|
|
6
|
+
* rather than exported component names.
|
|
7
|
+
*
|
|
8
|
+
* This configuration disables rules that conflict with these patterns for files
|
|
9
|
+
* in framework routing directories.
|
|
10
|
+
* @see https://github.com/RobEasthope/protomolecule/issues/299
|
|
11
|
+
*/
|
|
12
|
+
export declare const frameworkRouting: {
|
|
13
|
+
files: string[];
|
|
14
|
+
rules: {
|
|
15
|
+
"canonical/filename-match-exported": "off";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=frameworkRouting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameworkRouting.d.ts","sourceRoot":"","sources":["../../rules/frameworkRouting.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;;;;;CAcJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint configuration for framework-based file routing patterns.
|
|
3
|
+
*
|
|
4
|
+
* Modern meta-frameworks (Next.js, React Router, Remix, SvelteKit, Astro, Nuxt)
|
|
5
|
+
* use file-based routing where filenames are determined by routing conventions
|
|
6
|
+
* rather than exported component names.
|
|
7
|
+
*
|
|
8
|
+
* This configuration disables rules that conflict with these patterns for files
|
|
9
|
+
* in framework routing directories.
|
|
10
|
+
* @see https://github.com/RobEasthope/protomolecule/issues/299
|
|
11
|
+
*/
|
|
12
|
+
export const frameworkRouting = {
|
|
13
|
+
files: [
|
|
14
|
+
"**/routes/**/*.{ts,tsx,js,jsx}",
|
|
15
|
+
"**/app/**/*.{ts,tsx,js,jsx}",
|
|
16
|
+
"**/pages/**/*.{ts,tsx,js,jsx}", // Next.js legacy routing
|
|
17
|
+
"**/src/routes/**/*.{ts,tsx,js,jsx}", // SvelteKit pattern
|
|
18
|
+
"**/src/pages/**/*.{ts,tsx,js,jsx}", // Astro pattern
|
|
19
|
+
],
|
|
20
|
+
rules: {
|
|
21
|
+
// Disable filename-match-exported for framework routing directories
|
|
22
|
+
// File-based routing requires specific filenames (e.g., root.tsx, home.tsx)
|
|
23
|
+
// that don't match exported component names (e.g., Layout, Home, meta)
|
|
24
|
+
"canonical/filename-match-exported": "off",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignoredFileAndFolders.d.ts","sourceRoot":"","sources":["../../rules/ignoredFileAndFolders.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;CAmBT,CAAC"}
|