@gooddata/eslint-config 11.19.0-alpha.0 → 11.19.0-alpha.1

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 (45) hide show
  1. package/PACKAGES_V8.md +30 -0
  2. package/PACKAGES_V9.md +31 -0
  3. package/README.md +88 -19
  4. package/dist/base.d.ts +12 -0
  5. package/dist/base.js +2206 -0
  6. package/dist/base.json +9 -47
  7. package/dist/browser-esm.d.ts +12 -0
  8. package/dist/browser-esm.js +2226 -0
  9. package/dist/browser-esm.json +9 -47
  10. package/dist/browser.d.ts +12 -0
  11. package/dist/browser.js +2211 -0
  12. package/dist/browser.json +9 -47
  13. package/dist/esm-react-cypress.d.ts +12 -0
  14. package/dist/esm-react-cypress.js +2309 -0
  15. package/dist/esm-react-cypress.json +10 -48
  16. package/dist/esm-react-vitest-storybook.d.ts +12 -0
  17. package/dist/esm-react-vitest-storybook.js +2331 -0
  18. package/dist/esm-react-vitest-storybook.json +14 -50
  19. package/dist/esm-react-vitest.d.ts +12 -0
  20. package/dist/esm-react-vitest.js +2297 -0
  21. package/dist/esm-react-vitest.json +10 -48
  22. package/dist/esm-react.d.ts +12 -0
  23. package/dist/esm-react.js +2272 -0
  24. package/dist/esm-react.json +10 -48
  25. package/dist/esm-vitest.d.ts +12 -0
  26. package/dist/esm-vitest.js +2246 -0
  27. package/dist/esm-vitest.json +9 -47
  28. package/dist/esm.d.ts +12 -0
  29. package/dist/esm.js +2221 -0
  30. package/dist/esm.json +9 -47
  31. package/dist/react-cypress.d.ts +12 -0
  32. package/dist/react-cypress.js +2300 -0
  33. package/dist/react-cypress.json +10 -48
  34. package/dist/react-vitest.d.ts +12 -0
  35. package/dist/react-vitest.js +2288 -0
  36. package/dist/react-vitest.json +10 -48
  37. package/dist/react.d.ts +12 -0
  38. package/dist/react.js +2263 -0
  39. package/dist/react.json +10 -48
  40. package/dist/tsOverride.d.ts +35 -0
  41. package/dist/tsOverride.js +49 -0
  42. package/dist/vitest.d.ts +12 -0
  43. package/dist/vitest.js +2231 -0
  44. package/dist/vitest.json +9 -47
  45. package/package.json +73 -30
package/PACKAGES_V8.md ADDED
@@ -0,0 +1,30 @@
1
+ # ESLint V8 Packages
2
+
3
+ This table shows which packages are required for each configuration.
4
+
5
+ | Package | base | browser | browser-esm | esm | esm-react | esm-react-cypress | esm-react-vitest | esm-react-vitest-storybook | esm-vitest | react | react-cypress | react-vitest | vitest |
6
+ |-----------------------------------|--------|---------|-------------|--------|-----------|-------------------|------------------|----------------------------|------------|--------|---------------|--------------|--------|
7
+ | @testing-library/dom | | | | | | | | 10.4.1 | | | | | |
8
+ | @typescript-eslint/eslint-plugin | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 |
9
+ | @typescript-eslint/parser | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 |
10
+ | @vitest/eslint-plugin | | | | | | | 1.6.6 | 1.6.6 | 1.6.6 | | | 1.6.6 | 1.6.6 |
11
+ | eslint-config-prettier | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 |
12
+ | eslint-import-resolver-typescript | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 |
13
+ | eslint-plugin-chai-friendly | | | | | | 1.1.0 | | | | | 1.1.0 | | |
14
+ | eslint-plugin-cypress | | | | | | 3.6.0 | | | | | 3.6.0 | | |
15
+ | eslint-plugin-header | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 | 3.1.1 |
16
+ | eslint-plugin-import | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 |
17
+ | eslint-plugin-import-esm | | | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | | | | |
18
+ | eslint-plugin-jsdoc | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 |
19
+ | eslint-plugin-no-barrel-files | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 |
20
+ | eslint-plugin-no-only-tests | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 | 2.6.0 |
21
+ | eslint-plugin-prettier | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 |
22
+ | eslint-plugin-react | | | | | 7.37.5 | 7.37.5 | 7.37.5 | 7.37.5 | | 7.37.5 | 7.37.5 | 7.37.5 | |
23
+ | eslint-plugin-react-hooks | | | | | 5.2.0 | 5.2.0 | 5.2.0 | 5.2.0 | | 5.2.0 | 5.2.0 | 5.2.0 | |
24
+ | eslint-plugin-regexp | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 | 2.7.0 |
25
+ | eslint-plugin-sonarjs | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 |
26
+ | eslint-plugin-storybook | | | | | | | | 10.1.11 | | | | | |
27
+ | prettier | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 |
28
+ | react | | | | | | | | 19.1.1 | | | | | |
29
+ | react-dom | | | | | | | | 19.1.1 | | | | | |
30
+ | storybook | | | | | | | | ^10.1.11 | | | | | |
package/PACKAGES_V9.md ADDED
@@ -0,0 +1,31 @@
1
+ # ESLint V9 Packages
2
+
3
+ This table shows which packages are required for each configuration.
4
+
5
+ | Package | base | browser | browser-esm | esm | esm-react | esm-react-cypress | esm-react-vitest | esm-react-vitest-storybook | esm-vitest | react | react-cypress | react-vitest | vitest |
6
+ |-----------------------------------|--------|---------|-------------|--------|-----------|-------------------|------------------|----------------------------|------------|--------|---------------|--------------|--------|
7
+ | @eslint/js | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 | 9.28.0 |
8
+ | @testing-library/dom | | | | | | | | 10.4.1 | | | | | |
9
+ | @typescript-eslint/eslint-plugin | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 |
10
+ | @typescript-eslint/parser | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 | 8.52.0 |
11
+ | @vitest/eslint-plugin | | | | | | | 1.6.6 | 1.6.6 | 1.6.6 | | | 1.6.6 | 1.6.6 |
12
+ | eslint-config-prettier | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 | 10.1.8 |
13
+ | eslint-import-resolver-typescript | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 | 4.4.4 |
14
+ | eslint-plugin-chai-friendly | | | | | | 1.1.0 | | | | | 1.1.0 | | |
15
+ | eslint-plugin-cypress | | | | | | 3.6.0 | | | | | 3.6.0 | | |
16
+ | eslint-plugin-headers | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 | 1.3.3 |
17
+ | eslint-plugin-import | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 | 2.32.0 |
18
+ | eslint-plugin-import-esm | | | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | 1.2.1 | | | | |
19
+ | eslint-plugin-jsdoc | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 | 62.1.0 |
20
+ | eslint-plugin-no-barrel-files | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 | 1.2.2 |
21
+ | eslint-plugin-no-only-tests | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 |
22
+ | eslint-plugin-prettier | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 | 5.5.4 |
23
+ | eslint-plugin-react | | | | | 7.37.5 | 7.37.5 | 7.37.5 | 7.37.5 | | 7.37.5 | 7.37.5 | 7.37.5 | |
24
+ | eslint-plugin-react-hooks | | | | | 5.2.0 | 5.2.0 | 5.2.0 | 5.2.0 | | 5.2.0 | 5.2.0 | 5.2.0 | |
25
+ | eslint-plugin-sonarjs | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 | 3.0.6 |
26
+ | eslint-plugin-storybook | | | | | | | | 10.1.11 | | | | | |
27
+ | globals | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 | 17.2.0 |
28
+ | prettier | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 | ^3.6.2 |
29
+ | react | | | | | | | | 19.1.1 | | | | | |
30
+ | react-dom | | | | | | | | 19.1.1 | | | | | |
31
+ | storybook | | | | | | | | ^10.1.11 | | | | | |
package/README.md CHANGED
@@ -11,6 +11,7 @@ This package consolidates ESLint configurations that were previously scattered a
11
11
 
12
12
  The new approach provides:
13
13
 
14
+ - **ESLint v8 and v9 support** - Dual configuration format for both legacy and flat config
14
15
  - **Modular structure** - Rules organized by plugin/concern in separate files
15
16
  - **Easy to edit** - Find and modify rules in logical locations
16
17
  - **Unified configs** - Single source of truth for linting standards
@@ -31,10 +32,10 @@ The new approach provides:
31
32
  - `variants` object: Different combinations for specific use cases
32
33
 
33
34
  3. **Build Process** (`npm run build`)
34
- - Merges configuration modules into JSON files in `dist/`
35
- - Creates `base.json` (all common configs)
36
- - Creates variant files: `browser.json`, `react.json`, `esm-react.json`, etc.
37
- - Consumers import via: `@gooddata/eslint-config/react` `dist/react.json`
35
+ - Generates both ESLint v8 (JSON) and v9 (JS flat config) formats
36
+ - Creates `base.json` + `base.js` (all common configs)
37
+ - Creates variant files: `browser.json`/`.js`, `react.json`/`.js`, etc.
38
+ - Package exports use conditional exports: `require` JSON (v8), `import` → JS (v9)
38
39
 
39
40
  4. **Package Sync** (`npm run update-package`)
40
41
  - Auto-updates `package.json` dependencies and peer dependencies
@@ -43,24 +44,91 @@ The new approach provides:
43
44
 
44
45
  ## Available Variants
45
46
 
46
- - **base** (`.`) - Core rules for all packages
47
- - **browser** (`/browser`) - For packages using browser APIs (document, window)
48
- - **browser-esm** (`/browser-esm`) - Browser + ESM import rules
49
- - **esm** (`/esm`) - ESM-specific import rules
50
- - **esm-vitest** (`/esm-vitest`) - ESM + Vitest rules
51
- - **react** (`/react`) - Browser + React + React Hooks rules
52
- - **react-cypress** (`/react-cypress`) - Browser + React + React Hooks + Cypress rules
53
- - **esm-react** (`/esm-react`) - Browser + React + React Hooks + ESM rules (most React libraries)
54
- - **esm-react-cypress** (`/esm-react-cypress`) - Browser + React + React Hooks + ESM + Cypress rules
55
- - **esm-react-vitest** (`/esm-react-vitest`) - Browser + React + React Hooks + ESM + Vitest rules
47
+ For a complete list of available variants and their required packages, see:
48
+
49
+ - [PACKAGES_V8.md](./PACKAGES_V8.md) - Package requirements for ESLint v8 configurations
50
+ - [PACKAGES_V9.md](./PACKAGES_V9.md) - Package requirements for ESLint v9 configurations
51
+
52
+ ## ESLint v8 vs v9 Support
53
+
54
+ This package supports both ESLint v8 (legacy config) and ESLint v9 (flat config):
55
+
56
+ | ESLint Version | Config Format | File Extension | Import Type |
57
+ | -------------- | ------------- | ------------------ | ----------- |
58
+ | v8 | Legacy JSON | `.eslintrc.js` | `require()` |
59
+ | v9 | Flat Config | `eslint.config.js` | `import` |
60
+
61
+ The package uses conditional exports to automatically serve the correct format:
62
+
63
+ - **CommonJS/require** → Returns JSON config for ESLint v8
64
+ - **ESM/import** → Returns JS flat config for ESLint v9
65
+
66
+ Some packages differ between v8 and v9 (e.g., `eslint-plugin-header` vs `eslint-plugin-headers`). See [PACKAGES_V8.md](./PACKAGES_V8.md) and [PACKAGES_V9.md](./PACKAGES_V9.md) for the complete list of required packages for each version.
56
67
 
57
68
  ## Usage
58
69
 
59
- ### TypeScript Projects (Recommended)
70
+ ### ESLint v9 (Flat Config) - Recommended
71
+
72
+ For ESLint v9 with flat config, create an `eslint.config.js` or `eslint.config.ts` file:
73
+
74
+ ```typescript
75
+ // eslint.config.ts
76
+ // (C) 2025 GoodData Corporation
77
+
78
+ import config from "@gooddata/eslint-config/esm-react-vitest";
79
+
80
+ export default config;
81
+ ```
82
+
83
+ For TypeScript projects, use the `tsOverride` helper to configure the TypeScript parser with the correct `tsconfigRootDir`:
84
+
85
+ ```typescript
86
+ // eslint.config.ts
87
+ // (C) 2025 GoodData Corporation
88
+
89
+ import config from "@gooddata/eslint-config/esm-react-vitest";
90
+ import { tsOverride } from "@gooddata/eslint-config/tsOverride";
91
+
92
+ export default [
93
+ ...config,
94
+ tsOverride(import.meta.dirname, {
95
+ // Optional: Add custom TypeScript rule overrides here
96
+ "@typescript-eslint/no-namespace": "off",
97
+ }),
98
+ ];
99
+ ```
100
+
101
+ **What `tsOverride` does in v9:**
102
+
103
+ - Configures `languageOptions.parserOptions.tsconfigRootDir` to point to your project directory
104
+ - Applies to `**/*.ts` and `**/*.tsx` files
105
+ - Allows you to pass custom rule overrides as the second parameter
106
+
107
+ To add custom rules or overrides without TypeScript configuration:
108
+
109
+ ```typescript
110
+ // eslint.config.ts
111
+ // (C) 2025 GoodData Corporation
112
+
113
+ import config from "@gooddata/eslint-config/esm-react-vitest";
114
+
115
+ export default [
116
+ ...config,
117
+ {
118
+ rules: {
119
+ // Custom rule overrides
120
+ "@typescript-eslint/no-namespace": "off",
121
+ },
122
+ },
123
+ ];
124
+ ```
125
+
126
+ ### ESLint v8 (Legacy Config)
60
127
 
61
- For TypeScript projects, use the `tsOverride` helper which automatically configures the TypeScript parser, import resolver, and other required settings:
128
+ For TypeScript projects using ESLint v8, use the `tsOverride` helper which automatically configures the TypeScript parser, import resolver, and other required settings:
62
129
 
63
130
  ```javascript
131
+ // .eslintrc.js
64
132
  // (C) 2020 GoodData Corporation
65
133
 
66
134
  const { tsOverride } = require("@gooddata/eslint-config/tsOverride");
@@ -85,9 +153,9 @@ module.exports = {
85
153
  - Applies to `**/*.ts` and `**/*.tsx` files
86
154
  - Allows you to pass custom rule overrides as the second parameter
87
155
 
88
- ### Non-TypeScript Projects
156
+ ### Non-TypeScript Projects (v8)
89
157
 
90
- For non-TypeScript projects, simply extend the configuration:
158
+ For non-TypeScript projects using ESLint v8, simply extend the configuration:
91
159
 
92
160
  ```javascript
93
161
  module.exports = {
@@ -97,7 +165,7 @@ module.exports = {
97
165
 
98
166
  **Important Notes:**
99
167
 
100
- - **TypeScript Projects**: Using `tsOverride(__dirname, rules)` is **mandatory** for TypeScript projects. Without it, `@typescript-eslint/parser` won't know where to find your `tsconfig.json`, and import resolution will not work correctly.
168
+ - **ESLint v8 TypeScript Projects**: Using `tsOverride(__dirname, rules)` is **mandatory** for TypeScript projects with ESLint v8. Without it, `@typescript-eslint/parser` won't know where to find your `tsconfig.json`, and import resolution will not work correctly.
101
169
 
102
170
  - **Peer Dependencies**: Only packages from the `common` configuration are listed in `peerDependencies`. Variant-specific packages (e.g., `eslint-plugin-react` for the `react` variant) are **not** included as peer dependencies since they're not required by all consumers.
103
171
 
@@ -209,6 +277,7 @@ rules: {
209
277
  - **`npm run update-package`** - Syncs dependencies and exports
210
278
  - Updates `devDependencies` and `peerDependencies` in `package.json`
211
279
  - Updates `exports` field based on available variants
280
+ - Generates `PACKAGES_V8.md` and `PACKAGES_V9.md` documentation files
212
281
  - **Must run after**: adding variants, adding configs, changing package versions
213
282
 
214
283
  - **`npm run validate`** - Type-checks TypeScript files
package/dist/base.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export interface FlatConfig {
2
+ files?: string[];
3
+ ignores?: string[];
4
+ languageOptions?: Record<string, unknown>;
5
+ linterOptions?: Record<string, unknown>;
6
+ processor?: unknown;
7
+ plugins?: Record<string, unknown>;
8
+ rules?: Record<string, unknown>;
9
+ settings?: Record<string, unknown>;
10
+ }
11
+ declare const config: FlatConfig[];
12
+ export default config;