@fullstacksjs/eslint-config 14.4.0 → 14.6.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.
Files changed (54) hide show
  1. package/README.md +95 -60
  2. package/cjs/index.js +12 -2
  3. package/cjs/modules/base.js +5 -2
  4. package/cjs/modules/cypress.js +9 -3
  5. package/cjs/modules/ignore.js +1 -1
  6. package/cjs/modules/imports.js +5 -3
  7. package/cjs/modules/jest.js +5 -2
  8. package/cjs/modules/next.js +9 -3
  9. package/cjs/modules/node.js +5 -2
  10. package/cjs/modules/perfectionist.js +7 -3
  11. package/cjs/modules/playwright.js +9 -3
  12. package/cjs/modules/prettier.js +9 -3
  13. package/cjs/modules/promise.js +8 -2
  14. package/cjs/modules/react.js +8 -2
  15. package/cjs/modules/regex.js +5 -2
  16. package/cjs/modules/storybook.js +9 -3
  17. package/cjs/modules/stylistic.js +6 -3
  18. package/cjs/modules/tailwind.js +5 -2
  19. package/cjs/modules/tests.js +5 -2
  20. package/cjs/modules/typescript.js +5 -2
  21. package/cjs/modules/vitest.js +6 -2
  22. package/cjs/{index.d.ts → types/index.d.ts} +50 -52
  23. package/cjs/types/modules/import.d.ts +7 -0
  24. package/cjs/types/modules/react.d.ts +5 -0
  25. package/cjs/types/modules/regex.d.ts +5 -0
  26. package/cjs/types/modules/tailwind.d.ts +20 -0
  27. package/cjs/types/modules/typescript.d.ts +38 -0
  28. package/package.json +3 -2
  29. package/src/index.mjs +12 -2
  30. package/src/modules/base.mjs +6 -2
  31. package/src/modules/cypress.mjs +10 -3
  32. package/src/modules/ignore.mjs +1 -1
  33. package/src/modules/imports.mjs +5 -3
  34. package/src/modules/jest.mjs +6 -2
  35. package/src/modules/next.mjs +10 -3
  36. package/src/modules/node.mjs +6 -2
  37. package/src/modules/perfectionist.mjs +8 -3
  38. package/src/modules/playwright.mjs +10 -3
  39. package/src/modules/prettier.mjs +10 -3
  40. package/src/modules/promise.mjs +9 -2
  41. package/src/modules/react.mjs +9 -2
  42. package/src/modules/regex.mjs +6 -2
  43. package/src/modules/storybook.mjs +10 -3
  44. package/src/modules/stylistic.mjs +6 -3
  45. package/src/modules/tailwind.mjs +7 -2
  46. package/src/modules/tests.mjs +6 -2
  47. package/src/modules/typescript.mjs +6 -2
  48. package/src/modules/vitest.mjs +7 -2
  49. package/src/{index.d.ts → types/index.d.ts} +50 -52
  50. package/src/types/modules/import.d.ts +7 -0
  51. package/src/types/modules/react.d.ts +5 -0
  52. package/src/types/modules/regex.d.ts +5 -0
  53. package/src/types/modules/tailwind.d.ts +20 -0
  54. package/src/types/modules/typescript.d.ts +38 -0
package/README.md CHANGED
@@ -4,9 +4,7 @@
4
4
 
5
5
  <br/>
6
6
 
7
- ![download status][download-badge]
8
- ![version][version-badge]
9
- ![MIT License][license-badge]
7
+ ![download status][download-badge] ![version][version-badge] ![MIT License][license-badge]
10
8
 
11
9
  </div>
12
10
 
@@ -16,11 +14,12 @@
16
14
  npm install --save-dev @fullstacksjs/eslint-config eslint prettier
17
15
  ```
18
16
 
19
- ⚡️ That's it, you don't need to install any eslint-plugin! If you already have some plugins installed, please remove them.
17
+ ⚡️ That's it, you don't need to install any eslint-plugin! If you already have some plugins installed, please remove them.
20
18
 
21
19
  ## Usage
22
20
 
23
- To use the configuration, all you need is to export the generated config by the `defineConfig` function. It automatically enables required plugins with **Auto Module Detection**.
21
+ To use the configuration, all you need is to export the generated config by the `defineConfig` function. It automatically enables required
22
+ plugins with **Auto Module Detection**.
24
23
 
25
24
  ### ESM
26
25
 
@@ -30,7 +29,7 @@ import { defineConfig } from '@fullstacksjs/eslint-config';
30
29
  export default defineConfig({
31
30
  typescript: {
32
31
  tsconfigRootDir: import.meta.dirname, // Recommended when using TypeScript
33
- }
32
+ },
34
33
  });
35
34
  ```
36
35
 
@@ -42,44 +41,66 @@ const { defineConfig } = require('@fullstacksjs/eslint-config');
42
41
  module.exports = defineConfig({
43
42
  typescript: {
44
43
  tsconfigRootDir: __dirname, // Recommended when using TypeScript
45
- }
44
+ },
46
45
  });
47
46
  ```
48
47
 
49
48
  ## How Module Detection Works
50
49
 
51
- Automatic module detection enables ESLint plugins based on the dependencies listed in your `package.json`. It scans your project to identify which tools you're using, and then activates the corresponding ESLint plugins accordingly.
50
+ Automatic module detection enables ESLint plugins based on the dependencies listed in your `package.json`. It scans your project to identify
51
+ which tools you're using, and then activates the corresponding ESLint plugins accordingly.
52
52
 
53
- For example, if your `package.json` includes `vitest` as a dependency, the configuration will automatically enable `eslint-plugin-vitest` for you. (You don't need to install the plugin itself)
53
+ For example, if your `package.json` includes `vitest` as a dependency, the configuration will automatically enable `eslint-plugin-vitest`
54
+ for you. (You don't need to install the plugin itself)
54
55
 
55
56
  ### Modules API
56
57
 
57
- You can fine-tune module detection by overriding it, the `defineConfig` function accepts options as its first argument to control enabled modules.
58
+ You can fine-tune module detection by overriding it, the `defineConfig` function accepts options as its first argument to control enabled
59
+ modules.
58
60
 
59
61
  ```typescript
60
62
  interface Options {
61
- react?: boolean | { additionalEffectHooks?: string }; // controls react, react-hooks, jsx/a11y plugins
62
- typescript?: boolean | ParserOptions // https://typescript-eslint.io/packages/parser#configuration
63
- node?: boolean; // controls node plugin
64
- sort?: boolean; // controls perfectionist plugin
63
+ base?: boolean | ‌ConfigWithOverrides; // controls base
64
+ promise?: boolean | ‌ConfigWithOverrides; // controls promise
65
+ stylistic?: boolean | ‌ConfigWithOverrides; // controls stylistic
66
+ react?: boolean | ReactOptions; // controls react, react-hooks, jsx/a11y plugins
67
+ typescript?: boolean | TypeScriptOptions; // https://typescript-eslint.io/packages/parser#configuration
68
+ node?: boolean | ‌ConfigWithOverrides; // controls node plugin
69
+ sort?: boolean | ‌ConfigWithOverrides; // controls perfectionist plugin
65
70
  strict?: boolean; // controls strict rules
66
- import?: { internalRegExp?: string; lifetime?: number; }; // controls import plugin
71
+ import?: boolean | ImportOptions; // controls import plugin
67
72
  esm?: boolean; // controls esm plugin
68
- test?: boolean; // controls test formatting plugin
69
- jest?: boolean; // controls jest plugin
70
- vitest?: boolean; // controls vitest plugin
71
- cypress?: boolean; // controls cypress plugin
72
- playwright?: boolean // controls playwright plugin
73
- storybook?: boolean; // controls storybook plugin
74
- tailwind?: false | TailwindConfig; // controls tailwindcss plugin
75
- next?: boolean; // controls next plugin
76
- prettier?: boolean; // controls prettier plugin
73
+ test?: boolean | ‌ConfigWithOverrides; // controls test formatting plugin
74
+ jest?: boolean | ‌ConfigWithOverrides; // controls jest plugin
75
+ vitest?: boolean | ‌ConfigWithOverrides; // controls vitest plugin
76
+ cypress?: boolean | ‌ConfigWithOverrides; // controls cypress plugin
77
+ playwright?: boolean | ‌ConfigWithOverrides; // controls playwright plugin
78
+ storybook?: boolean | ‌ConfigWithOverrides; // controls storybook plugin
79
+ tailwind?: false | TailwindOptions; // controls tailwindcss plugin
80
+ next?: boolean | ‌ConfigWithOverrides; // controls next plugin
81
+ prettier?: boolean | ‌ConfigWithOverrides; // controls prettier plugin
77
82
  disableExpensiveRules?: boolean; // controls expensive rules
78
83
  gitignore?: false | string; // automatically ignore paths from .gitignore
79
- regex?: boolean | {allowedCharacterRanges?: string[]} // controls regexp plugin
84
+ regex?: boolean | RegexOptions; // controls regexp plugin
80
85
  }
81
86
  ```
82
87
 
88
+ ## Config Overrides
89
+
90
+ You can customize any generated ESLint configuration per module.
91
+
92
+ ```ts
93
+ defineConfig({
94
+ stylistic: {
95
+ overrides: {
96
+ rules: {
97
+ '@stylistic/semi': ['error', 'always'],
98
+ },
99
+ },
100
+ },
101
+ });
102
+ ```
103
+
83
104
  ## What if I want to add my one rules
84
105
 
85
106
  You can pass any number of arbitrary custom config overrides to `defineConfig` function:
@@ -92,30 +113,35 @@ export default defineConfig(
92
113
  typescript: true,
93
114
  // You can pass extends here
94
115
  rules: {
95
- 'no-console': 'error'
96
- }
116
+ 'no-console': 'error',
117
+ },
97
118
  },
98
119
  // And any number of extra configurations
99
120
  {
100
121
  files: ['**/*.ts'],
101
122
  rules: {},
102
- }, {
123
+ },
124
+ {
103
125
  rules: {},
104
- })
126
+ },
127
+ );
105
128
  ```
106
129
 
107
130
  ## What If I Want to Use a Plugin That Isn't Supported?
108
131
 
109
- You can still use any ESLint plugin, even if it's not supported by automatic detection. Simply install the plugin manually and add it to the `defineConfig`. There are no limitations.
132
+ You can still use any ESLint plugin, even if it's not supported by automatic detection. Simply install the plugin manually and add it to the
133
+ `defineConfig`. There are no limitations.
110
134
 
111
135
  ```js
112
136
  import { defineConfig } from '@fullstacksjs/eslint-config';
113
137
  import pluginVue from 'eslint-plugin-vue';
114
138
 
115
139
  export default defineConfig(
116
- { /* Options */},
117
- ...pluginVue.configs['flat/recommended']
118
- )
140
+ {
141
+ /* Options */
142
+ },
143
+ ...pluginVue.configs['flat/recommended'],
144
+ );
119
145
  ```
120
146
 
121
147
  ## Tailwind
@@ -123,38 +149,43 @@ export default defineConfig(
123
149
  To enable Tailwind CSS in your project, specify the path to your CSS file in the module configuration:
124
150
 
125
151
  Tailwind 4:
152
+
126
153
  ```typescript
127
154
  export default defineConfig({
128
155
  tailwind: { entryPoint: './src/global.css' },
129
- })
156
+ });
130
157
  ```
131
158
 
132
159
  Tailwind 3:
160
+
133
161
  ```typescript
134
162
  export default defineConfig({
135
163
  tailwind: { tailwindConfig: './tailwind.config.js' },
136
- })
164
+ });
137
165
  ```
138
166
 
139
167
  ## GitIgnore
140
168
 
141
- By default, FullstacksJS checks for a `.gitignore` file at the root of the project. If the file exists, it will be used automatically. You can override this behavior by updating the configuration.
169
+ By default, FullstacksJS checks for a `.gitignore` file at the root of the project. If the file exists, it will be used automatically. You
170
+ can override this behavior by updating the configuration.
142
171
 
143
172
  ```typescript
144
173
  export default defineConfig({
145
174
  gitignore: './packages/acme/.gitignore', // use `false` to disable
146
- })
175
+ });
147
176
  ```
148
177
 
149
178
  ## I'm Getting a Next.js Warning: Plugin Was Not Detected
150
179
 
151
- This configuration includes built-in support for [Next.js](https://nextjs.org). The warning you're seeing from Next.js is misleading—it simply checks whether the plugin is explicitly listed in your package.json.
180
+ This configuration includes built-in support for [Next.js](https://nextjs.org). The warning you're seeing from Next.js is misleading—it
181
+ simply checks whether the plugin is explicitly listed in your package.json.
152
182
 
153
183
  You can safely ignore this warning. Alternatively, you can update your lint script from next lint to eslint to avoid it entirely.
154
184
 
155
185
  ## Speed Optimization!
156
186
 
157
- Balancing the benefits of linting rules against their performance impact is crucial. Below is a table highlighting the most resource-intensive linting rules encountered in a real-world React project:
187
+ Balancing the benefits of linting rules against their performance impact is crucial. Below is a table highlighting the most
188
+ resource-intensive linting rules encountered in a real-world React project:
158
189
 
159
190
  | Rule | Time (ms) | Relative |
160
191
  | -------------------------------------- | --------- | -------- |
@@ -163,7 +194,10 @@ Balancing the benefits of linting rules against their performance impact is cruc
163
194
  | import/no-cycle | 1177.111 | 6.8% |
164
195
  | import/namespace | 1148.731 | 6.7% |
165
196
 
166
- As illustrated, certain rules significantly increase linting time, potentially hindering the developer experience by slowing down the feedback loop. To mitigate this, you may consider disabling these resource-intensive rules in the development environment. However, they can remain active in environments where performance is less critical, such as Continuous Integration (CI) systems or during pre-commit checks (git hooks).
197
+ As illustrated, certain rules significantly increase linting time, potentially hindering the developer experience by slowing down the
198
+ feedback loop. To mitigate this, you may consider disabling these resource-intensive rules in the development environment. However, they can
199
+ remain active in environments where performance is less critical, such as Continuous Integration (CI) systems or during pre-commit checks
200
+ (git hooks).
167
201
 
168
202
  To conditionally disable expensive linting rules, you can modify your configuration as follows:
169
203
 
@@ -184,7 +218,7 @@ import/no-deprecated
184
218
  ```js
185
219
  export default defineConfig({
186
220
  disableExpensiveRules: !process.env.CI || !process.env.HUSKY, // Or anywhere you want
187
- prettier: false // So you should run the formatter explicitly.
221
+ prettier: false, // So you should run the formatter explicitly.
188
222
  });
189
223
  ```
190
224
 
@@ -194,25 +228,26 @@ export default defineConfig({
194
228
 
195
229
  ## What's included?
196
230
 
197
- * [@eslint-react/eslint-plugin](https://eslint-react.xyz)
198
- * [@next/eslint-plugin-next](https://nextjs.org/docs/basic-features/eslint#eslint-plugin)
199
- * [@stylistic/eslint-plugin](https://eslint.style/packages/default)
200
- * [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest)
201
- * [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress)
202
- * [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x)
203
- * [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest)
204
- * [eslint-plugin-jest-formatting](https://github.com/dangreenisrael/eslint-plugin-jest-formatting)
205
- * [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
206
- * [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n)
207
- * [eslint-plugin-perfectionist](https://perfectionist.dev)
208
- * [eslint-plugin-playwright](https://github.com/playwright-community/eslint-plugin-playwright)
209
- * [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
210
- * [eslint-plugin-promise](https://github.com/eslint-community/eslint-plugin-promise)
211
- * [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)
212
- * [eslint-plugin-storybook](https://github.com/storybookjs/eslint-plugin-storybook#readme)
213
- * [eslint-plugin-better-tailwindcss](https://github.com/schoero/eslint-plugin-better-tailwindcss)
214
- * [typescript-eslint](https://typescript-eslint.io)
215
- * [eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp)
231
+ - [@eslint-react/eslint-plugin](https://eslint-react.xyz)
232
+ - [@next/eslint-plugin-next](https://nextjs.org/docs/basic-features/eslint#eslint-plugin)
233
+ - [@stylistic/eslint-plugin](https://eslint.style/packages/default)
234
+ - [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest)
235
+ - [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress)
236
+ - [eslint-plugin-import-x](https://github.com/un-ts/eslint-plugin-import-x)
237
+ - [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest)
238
+ - [eslint-plugin-jest-formatting](https://github.com/dangreenisrael/eslint-plugin-jest-formatting)
239
+ - [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
240
+ - [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n)
241
+ - [eslint-plugin-perfectionist](https://perfectionist.dev)
242
+ - [eslint-plugin-playwright](https://github.com/playwright-community/eslint-plugin-playwright)
243
+ - [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
244
+ - [eslint-plugin-promise](https://github.com/eslint-community/eslint-plugin-promise)
245
+ - [eslint-plugin-react-hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks)
246
+ - [eslint-plugin-storybook](https://github.com/storybookjs/eslint-plugin-storybook#readme)
247
+ - [eslint-plugin-better-tailwindcss](https://github.com/schoero/eslint-plugin-better-tailwindcss)
248
+ - [typescript-eslint](https://typescript-eslint.io)
249
+ - [eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp)
250
+ - [eslint-flat-config-utils](https://www.npmjs.com/package/eslint-flat-config-utils)
216
251
 
217
252
  That's all. Feel free to use 💛
218
253
 
package/cjs/index.js CHANGED
@@ -17,6 +17,7 @@ var _node = _interopRequireDefault(require("./modules/node.js"));
17
17
  var _perfectionist = _interopRequireDefault(require("./modules/perfectionist.js"));
18
18
  var _playwright = _interopRequireDefault(require("./modules/playwright.js"));
19
19
  var _prettier = _interopRequireDefault(require("./modules/prettier.js"));
20
+ var _promise = _interopRequireDefault(require("./modules/promise.js"));
20
21
  var _react = _interopRequireDefault(require("./modules/react.js"));
21
22
  var _regex = _interopRequireDefault(require("./modules/regex.js"));
22
23
  var _storybook = _interopRequireDefault(require("./modules/storybook.js"));
@@ -30,11 +31,14 @@ const testPackages = ['jest', 'vitest', 'cypress', '@playwright/test'];
30
31
 
31
32
  /**
32
33
  * @typedef {import('eslint').Linter.Config} Config
33
- * @typedef {import('./index.js').Options} Options
34
+ * @typedef {import('./types').Options} Options
34
35
  * /
35
36
 
36
37
  /** @type {Options} */
37
38
  const defaultOptions = {
39
+ base: true,
40
+ promise: true,
41
+ stylistic: true,
38
42
  cypress: (0, _localPkg.isPackageExists)('cypress'),
39
43
  disableExpensiveRules: false,
40
44
  esm: false,
@@ -83,6 +87,9 @@ function defineConfig(initOptions = {}, ...extend) {
83
87
  };
84
88
  }
85
89
  const {
90
+ base: enableBase,
91
+ promise: enablePromise,
92
+ stylistic: enableStylistic,
86
93
  sort: enableSort,
87
94
  cypress: enableCypress,
88
95
  disableExpensiveRules,
@@ -105,7 +112,10 @@ function defineConfig(initOptions = {}, ...extend) {
105
112
  regex: enableRegex,
106
113
  ...eslintOptions
107
114
  } = options;
108
- const rules = [(0, _ignore.default)(options), (0, _base.default)(options), (0, _stylistic.default)(options)];
115
+ const rules = [(0, _ignore.default)(options)];
116
+ if (enableBase) rules.push((0, _base.default)(options));
117
+ if (enablePromise) rules.push((0, _promise.default)(options));
118
+ if (enableStylistic) rules.push((0, _stylistic.default)(options));
109
119
  if (enableSort) rules.push((0, _perfectionist.default)(options));
110
120
  if (enableImport) rules.push((0, _imports.default)(options));
111
121
  if (enableTailwind) rules.push((0, _tailwind.default)(options));
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _globals = _interopRequireDefault(require("globals"));
8
9
  var _conditions = require("../utils/conditions.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
11
- * @param { import('../index.js').Options } options
12
+ * @param { import('../types').Options } options
12
13
  * @return { import('eslint').Linter.Config }
13
14
  */
14
15
  function base(options = {}) {
15
- return {
16
+ const baseConfig = {
17
+ name: 'base',
16
18
  languageOptions: {
17
19
  ecmaVersion: 'latest',
18
20
  sourceType: 'module',
@@ -224,5 +226,6 @@ function base(options = {}) {
224
226
  'no-console': (0, _conditions.strict)(options, 'warn')
225
227
  }
226
228
  };
229
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(baseConfig, options.base.overrides ?? {});
227
230
  }
228
231
  module.exports = base;
@@ -4,12 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginCypress = _interopRequireDefault(require("eslint-plugin-cypress"));
8
9
  var _globs = require("../utils/globs.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- /** @return { import('eslint').Linter.Config } */
11
- function cypress() {
12
- return {
11
+ /**
12
+ * @param { import('../types').Options } options
13
+ * @return { import('eslint').Linter.Config }
14
+ */
15
+ function cypress(options = {}) {
16
+ const cypressConfig = {
17
+ name: 'cypress',
13
18
  files: _globs.globs.e2e,
14
19
  plugins: {
15
20
  cypress: _eslintPluginCypress.default
@@ -27,5 +32,6 @@ function cypress() {
27
32
  '@typescript-eslint/no-namespace': 'off'
28
33
  }
29
34
  };
35
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(cypressConfig, options.cypress.overrides ?? {});
30
36
  }
31
37
  module.exports = cypress;
@@ -8,7 +8,7 @@ var _config = require("eslint/config");
8
8
  var _getGitignorePatterns = require("../utils/getGitignorePatterns.js");
9
9
  var _globs = require("../utils/globs.js");
10
10
  /**
11
- * @param { import('../index.js').Options } options
11
+ * @param { import('../types').Options } options
12
12
  * @return { import('eslint').Linter.Config }
13
13
  */
14
14
  function ignores(options = {}) {
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginImportX = _interopRequireDefault(require("eslint-plugin-import-x"));
8
9
  var _conditions = require("../utils/conditions.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -12,12 +13,13 @@ const jsExtensions = ['.mjs', '.js', '.jsx', '.cjs'];
12
13
  const allExtensions = [...jsExtensions, ...tsExtensions];
13
14
 
14
15
  /**
15
- * @param { import('../index.js').Options } options
16
+ * @param { import('../types').Options } options
16
17
  * @return { import('eslint').Linter.Config }
17
18
  */
18
19
  function imports(options = {}) {
19
20
  const isObject = typeof options.import === 'object';
20
- const config = {
21
+ const importsConfig = {
22
+ name: 'imports',
21
23
  plugins: {
22
24
  import: _eslintPluginImportX.default
23
25
  },
@@ -115,6 +117,6 @@ function imports(options = {}) {
115
117
  })
116
118
  }
117
119
  };
118
- return config;
120
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(importsConfig, options.import.overrides ?? {});
119
121
  }
120
122
  module.exports = imports;
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginJest = _interopRequireDefault(require("eslint-plugin-jest"));
8
9
  var _globals = _interopRequireDefault(require("globals"));
9
10
  var _conditions = require("../utils/conditions.js");
10
11
  var _globs = require("../utils/globs.js");
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
13
  /**
13
- * @param { import('../index.js').Options } options
14
+ * @param { import('../types').Options } options
14
15
  * @return { import('eslint').Linter.Config } */
15
16
  function jest(options = {}) {
16
17
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
17
- return {
18
+ const jestConfig = {
19
+ name: 'jest',
18
20
  files: _globs.globs.test,
19
21
  plugins: {
20
22
  jest: _eslintPluginJest.default
@@ -93,5 +95,6 @@ function jest(options = {}) {
93
95
  // }),
94
96
  }
95
97
  };
98
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(jestConfig, options.jest.overrides ?? {});
96
99
  }
97
100
  module.exports = jest;
@@ -5,10 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
 
7
7
  var _eslintPluginNext = _interopRequireDefault(require("@next/eslint-plugin-next"));
8
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /** @type { import('eslint').Linter.Config } */
10
- function next() {
11
- return {
10
+ /**
11
+ * @param { import('../types').Options } options
12
+ * @return { import('eslint').Linter.Config }
13
+ */
14
+ function next(options = {}) {
15
+ const nextConfig = {
16
+ name: 'next',
12
17
  plugins: {
13
18
  next: _eslintPluginNext.default
14
19
  },
@@ -36,5 +41,6 @@ function next() {
36
41
  'next/no-unwanted-polyfillio': 'warn'
37
42
  }
38
43
  };
44
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(nextConfig, options.next.overrides ?? {});
39
45
  }
40
46
  module.exports = next;
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginN = _interopRequireDefault(require("eslint-plugin-n"));
8
9
  var _conditions = require("../utils/conditions.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
11
- * @param { import('../index.js').Options } options
12
+ * @param { import('../types').Options } options
12
13
  * @return { import('eslint').Linter.Config }
13
14
  */
14
15
  function node(options = {}) {
15
- return {
16
+ const nodeConfig = {
17
+ name: 'node',
16
18
  plugins: {
17
19
  n: _eslintPluginN.default
18
20
  },
@@ -67,5 +69,6 @@ function node(options = {}) {
67
69
  'n/no-missing-require': 'off'
68
70
  }
69
71
  };
72
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(nodeConfig, options.node.overrides ?? {});
70
73
  }
71
74
  module.exports = node;
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginPerfectionist = _interopRequireDefault(require("eslint-plugin-perfectionist"));
8
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
10
  /**
10
- * @return { import('eslint').Linter.Config }
11
+ * @param { import('../types').Options } options
12
+ * @return { Promise<import('eslint').Linter.Config> }
11
13
  */
12
- function perfectionist() {
13
- return {
14
+ function perfectionist(options = {}) {
15
+ const perfectionistConfig = {
16
+ name: 'perfectionist',
14
17
  plugins: {
15
18
  perfectionist: _eslintPluginPerfectionist.default
16
19
  },
@@ -44,5 +47,6 @@ function perfectionist() {
44
47
  'perfectionist/sort-variable-declarations': 'warn'
45
48
  }
46
49
  };
50
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(perfectionistConfig, options.sort.overrides ?? {});
47
51
  }
48
52
  module.exports = perfectionist;
@@ -4,12 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginPlaywright = _interopRequireDefault(require("eslint-plugin-playwright"));
8
9
  var _globs = require("../utils/globs.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- /** @return { import('eslint').Linter.Config } */
11
- function playwright() {
12
- return {
11
+ /**
12
+ * @param { import('../types').Options } options
13
+ * @return { Promise<import('eslint').Linter.Config> }
14
+ */
15
+ function playwright(options = {}) {
16
+ const playwrightConfig = {
17
+ name: 'playwright',
13
18
  plugins: {
14
19
  playwright: _eslintPluginPlaywright.default
15
20
  },
@@ -77,5 +82,6 @@ function playwright() {
77
82
  'playwright/valid-title': 'warn'
78
83
  }
79
84
  };
85
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(playwrightConfig, options.playwright.overrides ?? {});
80
86
  }
81
87
  module.exports = playwright;
@@ -4,11 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginPrettier = _interopRequireDefault(require("eslint-plugin-prettier"));
8
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /** @return { import('eslint').Linter.Config } */
10
- function prettier() {
11
- return {
10
+ /**
11
+ * @param { import('../types').Options } options
12
+ * @return { Promise<import('eslint').Linter.Config> }
13
+ */
14
+ function prettier(options = {}) {
15
+ const prettierConfig = {
16
+ name: 'prettier',
12
17
  plugins: {
13
18
  prettier: _eslintPluginPrettier.default
14
19
  },
@@ -91,5 +96,6 @@ function prettier() {
91
96
  'vue/template-curly-spacing': 'off'
92
97
  }
93
98
  };
99
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(prettierConfig, options.prettier.overrides ?? {});
94
100
  }
95
101
  module.exports = prettier;
@@ -4,12 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
7
8
  var _eslintPluginPromise = _interopRequireDefault(require("eslint-plugin-promise"));
8
9
  var _conditions = require("../utils/conditions.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- /** @return { import('eslint').Linter.Config } */
11
+ /**
12
+ * @param { import('../types').Options } options
13
+ * @return { Promise<import('eslint').Linter.Config> }
14
+ */
11
15
  function promise(options = {}) {
12
- return {
16
+ const promiseConfig = {
17
+ name: 'promise',
13
18
  plugins: {
14
19
  promise: _eslintPluginPromise.default
15
20
  },
@@ -33,5 +38,6 @@ function promise(options = {}) {
33
38
  'promise/spec-only': 'warn'
34
39
  }
35
40
  };
41
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(promiseConfig, options.promise.overrides ?? {});
36
42
  }
37
43
  module.exports = promise;
@@ -5,16 +5,21 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
 
7
7
  var _eslintPlugin = _interopRequireDefault(require("@eslint-react/eslint-plugin"));
8
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
9
  var _eslintPluginJsxA11y = _interopRequireDefault(require("eslint-plugin-jsx-a11y"));
9
10
  var _eslintPluginReactHooks = _interopRequireDefault(require("eslint-plugin-react-hooks"));
10
11
  var _typescriptEslint = require("typescript-eslint");
11
12
  var _conditions = require("../utils/conditions.js");
12
13
  var _globs = require("../utils/globs.js");
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- /** @return { import('eslint').Linter.Config } */
15
+ /**
16
+ * @param { import('../types').Options } options
17
+ * @return { Promise<import('eslint').Linter.Config> }
18
+ */
15
19
  function react(options = {}) {
16
20
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
17
- return {
21
+ const reactConfig = {
22
+ name: 'react',
18
23
  files: [_globs.globs.js, _globs.globs.jsx, _globs.globs.ts, _globs.globs.tsx],
19
24
  plugins: {
20
25
  ..._eslintPlugin.default.configs.all.plugins,
@@ -162,5 +167,6 @@ function react(options = {}) {
162
167
  'jsx-a11y/prefer-tag-over-role': 'off'
163
168
  }
164
169
  };
170
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(reactConfig, options.react.overrides ?? {});
165
171
  }
166
172
  module.exports = react;