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

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 (72) hide show
  1. package/LICENSE +7 -0
  2. package/PACKAGES_V8.md +26 -0
  3. package/PACKAGES_V9.md +28 -0
  4. package/PACKAGES_V9_OXLINT.md +28 -0
  5. package/README.md +135 -35
  6. package/dist/base.d.ts +12 -0
  7. package/dist/base.js +1869 -0
  8. package/dist/base.json +441 -98
  9. package/dist/browser-esm.d.ts +12 -0
  10. package/dist/browser-esm.js +1889 -0
  11. package/dist/browser-esm.json +442 -99
  12. package/dist/browser.d.ts +12 -0
  13. package/dist/browser.js +1874 -0
  14. package/dist/browser.json +441 -98
  15. package/dist/esm-react-cypress.d.ts +12 -0
  16. package/dist/esm-react-cypress.js +1991 -0
  17. package/dist/esm-react-cypress.json +454 -101
  18. package/dist/esm-react-vitest-storybook.d.ts +12 -0
  19. package/dist/esm-react-vitest-storybook.js +2013 -0
  20. package/dist/esm-react-vitest-storybook.json +480 -100
  21. package/dist/esm-react-vitest.d.ts +12 -0
  22. package/dist/esm-react-vitest.js +1979 -0
  23. package/dist/esm-react-vitest.json +463 -101
  24. package/dist/esm-react.d.ts +12 -0
  25. package/dist/esm-react.js +1935 -0
  26. package/dist/esm-react.json +440 -99
  27. package/dist/esm-vitest.d.ts +12 -0
  28. package/dist/esm-vitest.js +1928 -0
  29. package/dist/esm-vitest.json +465 -101
  30. package/dist/esm.d.ts +12 -0
  31. package/dist/esm.js +1884 -0
  32. package/dist/esm.json +442 -99
  33. package/dist/oxlint-base.d.ts +12 -0
  34. package/dist/oxlint-base.js +1869 -0
  35. package/dist/oxlint-browser-esm.d.ts +12 -0
  36. package/dist/oxlint-browser-esm.js +1889 -0
  37. package/dist/oxlint-browser.d.ts +12 -0
  38. package/dist/oxlint-browser.js +1874 -0
  39. package/dist/oxlint-esm-react-cypress.d.ts +12 -0
  40. package/dist/oxlint-esm-react-cypress.js +1991 -0
  41. package/dist/oxlint-esm-react-vitest-storybook.d.ts +12 -0
  42. package/dist/oxlint-esm-react-vitest-storybook.js +2013 -0
  43. package/dist/oxlint-esm-react-vitest.d.ts +12 -0
  44. package/dist/oxlint-esm-react-vitest.js +1979 -0
  45. package/dist/oxlint-esm-react.d.ts +12 -0
  46. package/dist/oxlint-esm-react.js +1935 -0
  47. package/dist/oxlint-esm-vitest.d.ts +12 -0
  48. package/dist/oxlint-esm-vitest.js +1928 -0
  49. package/dist/oxlint-esm.d.ts +12 -0
  50. package/dist/oxlint-esm.js +1884 -0
  51. package/dist/oxlint-react-cypress.d.ts +12 -0
  52. package/dist/oxlint-react-cypress.js +1982 -0
  53. package/dist/oxlint-react-vitest.d.ts +12 -0
  54. package/dist/oxlint-react-vitest.js +1970 -0
  55. package/dist/oxlint-react.d.ts +12 -0
  56. package/dist/oxlint-react.js +1926 -0
  57. package/dist/oxlint-vitest.d.ts +12 -0
  58. package/dist/oxlint-vitest.js +1913 -0
  59. package/dist/react-cypress.d.ts +12 -0
  60. package/dist/react-cypress.js +1982 -0
  61. package/dist/react-cypress.json +453 -100
  62. package/dist/react-vitest.d.ts +12 -0
  63. package/dist/react-vitest.js +1970 -0
  64. package/dist/react-vitest.json +462 -100
  65. package/dist/react.d.ts +12 -0
  66. package/dist/react.js +1926 -0
  67. package/dist/react.json +438 -97
  68. package/dist/vitest.d.ts +12 -0
  69. package/dist/vitest.js +1913 -0
  70. package/dist/vitest.json +464 -100
  71. package/package.json +122 -48
  72. package/dist/tsOverride.cjs +0 -23
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2022 GoodData Corporation
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/PACKAGES_V8.md ADDED
@@ -0,0 +1,26 @@
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-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 |
12
+ | eslint-plugin-chai-friendly | | | | | | 1.1.0 | | | | | 1.1.0 | | |
13
+ | eslint-plugin-cypress | | | | | | 3.6.0 | | | | | 3.6.0 | | |
14
+ | 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 |
15
+ | 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 | | | | |
16
+ | eslint-plugin-import-x | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 |
17
+ | 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 |
18
+ | 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 |
19
+ | 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 |
20
+ | eslint-plugin-react | | | | | 7.37.5 | 7.37.5 | 7.37.5 | 7.37.5 | | 7.37.5 | 7.37.5 | 7.37.5 | |
21
+ | 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 | |
22
+ | 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 |
23
+ | eslint-plugin-storybook | | | | | | | | 10.1.11 | | | | | |
24
+ | react | | | | | | | | 19.1.1 | | | | | |
25
+ | react-dom | | | | | | | | 19.1.1 | | | | | |
26
+ | storybook | | | | | | | | ^10.1.11 | | | | | |
package/PACKAGES_V9.md ADDED
@@ -0,0 +1,28 @@
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-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-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 |
16
+ | 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 | | | | |
17
+ | eslint-plugin-import-x | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.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 | | | | | | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | | 3.3.0 | 3.3.0 | 3.3.0 |
21
+ | eslint-plugin-react | | | | | 7.37.5 | 7.37.5 | 7.37.5 | 7.37.5 | | 7.37.5 | 7.37.5 | 7.37.5 | |
22
+ | 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 | |
23
+ | 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 |
24
+ | eslint-plugin-storybook | | | | | | | | 10.1.11 | | | | | |
25
+ | 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 |
26
+ | react | | | | | | | | 19.1.1 | | | | | |
27
+ | react-dom | | | | | | | | 19.1.1 | | | | | |
28
+ | storybook | | | | | | | | ^10.1.11 | | | | | |
@@ -0,0 +1,28 @@
1
+ # ESLint V9 OxLint Packages
2
+
3
+ This table shows which packages are required for each configuration.
4
+
5
+ | Package | oxlint-base | oxlint-browser | oxlint-browser-esm | oxlint-esm | oxlint-esm-react | oxlint-esm-react-cypress | oxlint-esm-react-vitest | oxlint-esm-react-vitest-storybook | oxlint-esm-vitest | oxlint-react | oxlint-react-cypress | oxlint-react-vitest | oxlint-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-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-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 |
16
+ | 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 | | | | |
17
+ | eslint-plugin-import-x | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.1 | 4.16.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 | | | | | | 3.3.0 | 3.3.0 | 3.3.0 | 3.3.0 | | 3.3.0 | 3.3.0 | 3.3.0 |
21
+ | eslint-plugin-react | | | | | 7.37.5 | 7.37.5 | 7.37.5 | 7.37.5 | | 7.37.5 | 7.37.5 | 7.37.5 | |
22
+ | 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 | |
23
+ | 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 |
24
+ | eslint-plugin-storybook | | | | | | | | 10.1.11 | | | | | |
25
+ | 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 |
26
+ | react | | | | | | | | 19.1.1 | | | | | |
27
+ | react-dom | | | | | | | | 19.1.1 | | | | | |
28
+ | 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,51 +44,129 @@ 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
+ - [PACKAGES_V9_OXLINT.md](./PACKAGES_V9_OXLINT.md) - Package requirements for ESLint v9 + oxlint configurations
52
+
53
+ ## OxLint Migration Variants
54
+
55
+ This package also provides `oxlint-*` variants designed to be used alongside `@gooddata/oxlint-config`. These variants have certain ESLint plugins disabled because those rules are handled by oxlint instead, providing faster linting performance.
56
+
57
+ **How it works:**
58
+
59
+ - **eslint-config `oxlint-*` variants** contain ESLint rules that oxlint does not support
60
+ - **oxlint-config** contains the equivalent rules handled by oxlint
61
+ - Together, they provide the same coverage as the standard ESLint variants, but with oxlint handling the bulk of the work for better performance
62
+
63
+ **Example usage:**
64
+
65
+ ```typescript
66
+ // eslint.config.ts
67
+ import config from "@gooddata/eslint-config/oxlint-esm-react-vitest";
68
+
69
+ export default config;
70
+ ```
71
+
72
+ See `@gooddata/oxlint-config` for the corresponding oxlint configuration and detailed setup instructions.
73
+
74
+ ## ESLint v8 vs v9 Support
75
+
76
+ This package supports both ESLint v8 (legacy config) and ESLint v9 (flat config):
77
+
78
+ | ESLint Version | Config Format | File Extension | Import Type |
79
+ | -------------- | ------------- | ------------------ | ----------- |
80
+ | v8 | Legacy JSON | `.eslintrc.js` | `require()` |
81
+ | v9 | Flat Config | `eslint.config.js` | `import` |
82
+
83
+ The package uses conditional exports to automatically serve the correct format:
84
+
85
+ - **CommonJS/require** → Returns JSON config for ESLint v8
86
+ - **ESM/import** → Returns JS flat config for ESLint v9
87
+
88
+ 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
89
 
57
90
  ## Usage
58
91
 
59
- ### TypeScript Projects (Recommended)
92
+ ### ESLint v9 (Flat Config) - Recommended
93
+
94
+ For ESLint v9 with flat config, create an `eslint.config.js` or `eslint.config.ts` file:
95
+
96
+ ```typescript
97
+ // eslint.config.ts
98
+ // (C) 2025 GoodData Corporation
99
+
100
+ import config from "@gooddata/eslint-config/esm-react-vitest";
101
+
102
+ export default config;
103
+ ```
60
104
 
61
- For TypeScript projects, use the `tsOverride` helper which automatically configures the TypeScript parser, import resolver, and other required settings:
105
+ To add custom rules or overrides:
106
+
107
+ ```typescript
108
+ // eslint.config.ts
109
+ // (C) 2025 GoodData Corporation
110
+
111
+ import config from "@gooddata/eslint-config/esm-react-vitest";
112
+
113
+ export default [
114
+ ...config,
115
+ {
116
+ rules: {
117
+ // Custom rule overrides (applies to all files)
118
+ "no-console": "warn",
119
+ },
120
+ },
121
+ ];
122
+ ```
123
+
124
+ To add TypeScript-specific rule overrides, specify a `files` pattern:
125
+
126
+ ```typescript
127
+ // eslint.config.ts
128
+ // (C) 2025 GoodData Corporation
129
+
130
+ import config from "@gooddata/eslint-config/esm-react-vitest";
131
+
132
+ export default [
133
+ ...config,
134
+ {
135
+ files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
136
+ rules: {
137
+ // TypeScript rule overrides (applies only to TS files)
138
+ "@typescript-eslint/no-namespace": "off",
139
+ "@typescript-eslint/no-explicit-any": "warn",
140
+ },
141
+ },
142
+ ];
143
+ ```
144
+
145
+ ### ESLint v8 (Legacy Config)
146
+
147
+ For ESLint v8, use the legacy JSON-based configuration:
62
148
 
63
149
  ```javascript
150
+ // .eslintrc.js
64
151
  // (C) 2020 GoodData Corporation
65
152
 
66
- const { tsOverride } = require("@gooddata/eslint-config/tsOverride");
67
-
68
153
  module.exports = {
69
154
  extends: ["@gooddata/eslint-config/react"],
70
155
  overrides: [
71
- tsOverride(__dirname, {
72
- // Optional: Add custom TypeScript rule overrides here
73
- "@typescript-eslint/no-namespace": "off",
74
- "@typescript-eslint/no-unsafe-assignment": "off",
75
- }),
156
+ {
157
+ files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
158
+ rules: {
159
+ // Custom TypeScript rule overrides
160
+ "@typescript-eslint/no-namespace": "off",
161
+ },
162
+ },
76
163
  ],
77
164
  };
78
165
  ```
79
166
 
80
- **What `tsOverride` does:**
167
+ ### Non-TypeScript Projects (v8)
81
168
 
82
- - Sets up the TypeScript parser (`@typescript-eslint/parser`)
83
- - Configures `tsconfigRootDir` to point to your project directory
84
- - Configures the import resolver to handle TypeScript imports correctly
85
- - Applies to `**/*.ts` and `**/*.tsx` files
86
- - Allows you to pass custom rule overrides as the second parameter
87
-
88
- ### Non-TypeScript Projects
89
-
90
- For non-TypeScript projects, simply extend the configuration:
169
+ For non-TypeScript projects using ESLint v8, simply extend the configuration:
91
170
 
92
171
  ```javascript
93
172
  module.exports = {
@@ -97,8 +176,6 @@ module.exports = {
97
176
 
98
177
  **Important Notes:**
99
178
 
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.
101
-
102
179
  - **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
180
 
104
181
  - **Verify Dependencies**: After adopting a configuration, run `npm run eslint` (or your lint command) to ensure all necessary dependencies are present in your project. If you get plugin errors, install the missing packages.
@@ -209,6 +286,7 @@ rules: {
209
286
  - **`npm run update-package`** - Syncs dependencies and exports
210
287
  - Updates `devDependencies` and `peerDependencies` in `package.json`
211
288
  - Updates `exports` field based on available variants
289
+ - Generates `PACKAGES_V8.md` and `PACKAGES_V9.md` documentation files
212
290
  - **Must run after**: adding variants, adding configs, changing package versions
213
291
 
214
292
  - **`npm run validate`** - Type-checks TypeScript files
@@ -269,3 +347,25 @@ interface IConfiguration<RulePrefix extends string = ""> {
269
347
 
270
348
  - The base configuration automatically ignores `**/dist/**/*.*` and `**/esm/**/*.*` files.
271
349
  - **ESM vs ImportESM**: The `esm` configuration sets `parserOptions.sourceType: "module"` to tell the parser to treat files as ES modules. The `importEsm` configuration adds the `eslint-plugin-import-esm` plugin which enforces ESM-specific import rules (e.g., requiring `.js` extensions in imports). Most ESM projects need both.
350
+
351
+ ## Formatting
352
+
353
+ This package is **decoupled from formatters**. The `formatter` configuration (included in all variants by default) disables ESLint rules that conflict with code formatters, allowing you to use any formatter of your choice (Prettier, oxfmt, Biome, etc.) as a separate tool.
354
+
355
+ **How it works:**
356
+
357
+ - ESLint focuses solely on code quality and best practices
358
+ - Formatting rules (indentation, spacing, quotes, etc.) are disabled
359
+ - Run your formatter separately (e.g., `prettier --write` or `oxfmt`)
360
+
361
+ **Recommended setup:**
362
+
363
+ 1. Install your preferred formatter (e.g., `prettier` or `oxfmt`)
364
+ 2. Configure it separately (e.g., `.prettierrc` or `oxfmt.json`)
365
+ 3. Run formatting as a separate step in your workflow or editor
366
+
367
+ This approach provides:
368
+
369
+ - **Flexibility** - Choose any formatter without changing ESLint config
370
+ - **Performance** - Formatters run faster when not piped through ESLint
371
+ - **Clarity** - Clear separation between linting (code quality) and formatting (code style)
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;