@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
@@ -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 plugin = _interopRequireWildcard(require("eslint-plugin-regexp"));
8
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
10
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
11
  /**
11
- * @param { import('../index.js').Options } options
12
+ * @param { import('../types').Options } options
12
13
  * @return { Promise<import('eslint').Linter.Config> }
13
14
  */
14
15
  function regex(options = {}) {
15
- return {
16
+ const regexConfig = {
17
+ name: 'regex',
16
18
  plugins: {
17
19
  regexp: plugin
18
20
  },
@@ -109,5 +111,6 @@ function regex(options = {}) {
109
111
  'no-empty-character-class': 'off'
110
112
  }
111
113
  };
114
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(regexConfig, options.regex.overrides ?? {});
112
115
  }
113
116
  module.exports = regex;
@@ -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 _eslintPluginStorybook = _interopRequireDefault(require("eslint-plugin-storybook"));
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 storybook() {
12
- return {
11
+ /**
12
+ * @param { import('../types').Options } options
13
+ * @return { Promise<import('eslint').Linter.Config> }
14
+ */
15
+ function storybook(options = {}) {
16
+ const storybookConfig = {
17
+ name: 'storybook',
13
18
  files: _globs.globs.storybook,
14
19
  plugins: {
15
20
  storybook: _eslintPluginStorybook.default
@@ -37,5 +42,6 @@ function storybook() {
37
42
  'react-hooks/rules-of-hooks': 'off'
38
43
  }
39
44
  };
45
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(storybookConfig, options.storybook.overrides ?? {});
40
46
  }
41
47
  module.exports = storybook;
@@ -5,13 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
 
7
7
  var _eslintPlugin = _interopRequireDefault(require("@stylistic/eslint-plugin"));
8
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
10
  /**
10
- * @param { import('../index.js').Options } options
11
+ * @param { import('../types').Options } options
11
12
  * @return { Promise<import('eslint').Linter.Config> }
12
13
  */
13
- function stylistic() {
14
- return {
14
+ function stylistic(options = {}) {
15
+ const stylisticConfig = {
16
+ name: 'stylistic',
15
17
  plugins: {
16
18
  '@stylistic': _eslintPlugin.default
17
19
  },
@@ -85,5 +87,6 @@ function stylistic() {
85
87
  }]
86
88
  }
87
89
  };
90
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(stylisticConfig, options.stylistic.overrides ?? {});
88
91
  }
89
92
  module.exports = stylistic;
@@ -4,14 +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 _conditions = require("../utils/conditions.js");
8
9
  /**
9
- * @param { import('../index.js').Options } options
10
+ * @param { import('../types').Options } options
10
11
  * @return { Promise<import('eslint').Linter.Config> }
11
12
  */
12
13
  async function tailwind(options = {}) {
13
14
  const plugin = await Promise.resolve().then(() => require('eslint-plugin-better-tailwindcss'));
14
- return {
15
+ const tailwindConfig = {
16
+ name: 'tailwind',
15
17
  plugins: {
16
18
  'better-tailwindcss': plugin.default ?? plugin
17
19
  },
@@ -41,5 +43,6 @@ async function tailwind(options = {}) {
41
43
  'better-tailwindcss/no-unnecessary-whitespace': 'warn'
42
44
  }
43
45
  };
46
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(tailwindConfig, options.tailwind.overrides ?? {});
44
47
  }
45
48
  module.exports = tailwind;
@@ -5,17 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
 
7
7
  var _eslintPlugin = _interopRequireDefault(require("@vitest/eslint-plugin"));
8
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
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
  */
16
17
 
17
18
  function tests(options = {}) {
18
- return {
19
+ const testsConfug = {
20
+ name: 'tests',
19
21
  files: [..._globs.globs.test, ..._globs.globs.e2e],
20
22
  plugins: {
21
23
  vitest: _eslintPlugin.default
@@ -43,5 +45,6 @@ function tests(options = {}) {
43
45
  })
44
46
  }
45
47
  };
48
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(testsConfug, options.test.overrides ?? {});
46
49
  }
47
50
  module.exports = tests;
@@ -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 _typescriptEslint = require("typescript-eslint");
8
9
  var _conditions = require("../utils/conditions.js");
9
10
  var _globs = require("../utils/globs.js");
10
11
  var _namingConvention = require("../utils/naming-convention.js");
11
12
  /**
12
- * @param { import('../index.js').Options } options
13
+ * @param { import('../types').Options } options
13
14
  * @return { import('eslint').Linter.Config }
14
15
  */
15
16
  function typescript(options = {}) {
16
17
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
17
- return {
18
+ const typescriptConfig = {
19
+ name: 'typescript',
18
20
  files: [_globs.globs.ts, _globs.globs.tsx],
19
21
  plugins: {
20
22
  '@typescript-eslint': _typescriptEslint.plugin
@@ -278,5 +280,6 @@ function typescript(options = {}) {
278
280
  'no-duplicate-imports': 'off'
279
281
  }
280
282
  };
283
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(typescriptConfig, options.typescript.overrides ?? {});
281
284
  }
282
285
  module.exports = typescript;
@@ -5,13 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
 
7
7
  var _eslintPlugin = _interopRequireDefault(require("@vitest/eslint-plugin"));
8
+ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
9
  var _globs = require("../utils/globs.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
12
+ * @param { import('../types').Options } options
11
13
  * @return { import('eslint').Linter.Config }
12
14
  */
13
- function vitest() {
14
- return {
15
+ function vitest(options = {}) {
16
+ const vitestConfig = {
17
+ name: 'vitest',
15
18
  files: _globs.globs.test,
16
19
  plugins: {
17
20
  vitest: _eslintPlugin.default
@@ -107,5 +110,6 @@ function vitest() {
107
110
  'vitest/warn-todo': 'warn'
108
111
  }
109
112
  };
113
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(vitestConfig, options.vitest.overrides ?? {});
110
114
  }
111
115
  module.exports = vitest;
@@ -1,69 +1,57 @@
1
1
  import type { Linter } from 'eslint';
2
+ import type { ConfigWithExtends } from 'eslint-flat-config-utils';
2
3
 
3
- /**
4
- * Granular options to configure the project service.
5
- */
6
- export interface ProjectServiceOptions {
7
- /**
8
- * Globs of files to allow running with the default project compiler options
9
- * despite not being matched by the project service.
10
- */
11
- allowDefaultProject?: string[];
12
-
13
- /**
14
- * Path to a TSConfig to use instead of TypeScript's default project configuration.
15
- * @default 'tsconfig.json'
16
- */
17
- defaultProject?: string;
18
-
19
- /**
20
- * Whether to allow TypeScript plugins as configured in the TSConfig.
21
- */
22
- loadTypeScriptPlugins?: boolean;
4
+ import type { ImportOptions } from './modules/import';
5
+ import type { ReactOptions } from './modules/react';
6
+ import type { RegexOptions } from './modules/regex';
7
+ import type { TailwindOptions } from './modules/tailwind';
8
+ import type { TypeScriptOptions } from './modules/typescript';
23
9
 
10
+ interface ConfigWithOverrides {
24
11
  /**
25
- * The maximum number of files {@link allowDefaultProject} may match.
26
- * Each file match slows down linting, so if you do need to use this, please
27
- * file an informative issue on typescript-eslint explaining why - so we can
28
- * help you avoid using it!
29
- * @default 8
12
+ * Override the configuration.
13
+ *
14
+ * The properties of this object are merged with and take precedence over the default configuration.
15
+ *
16
+ * There is no guarantee that the resulting configuration works correctly — it depends on the options you provide.
17
+ *
18
+ * @see [eslint-flat-config-utils: `mergeConfigs`](https://jsr.io/@antfu/eslint-flat-config-utils/doc/~/mergeConfigs)
30
19
  */
31
- maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING?: number;
20
+ overrides?: ConfigWithExtends;
32
21
  }
33
22
 
34
- type TailwindConfig = {
35
- callees?: string[];
36
- variables?: string[];
37
- attributes?: string[];
38
- tags?: string[];
39
- } & ({ entryPoint: string; tailwindConfig?: string } | { entryPoint?: string; tailwindConfig: string });
40
-
41
23
  export interface Options extends Linter.Config {
24
+ /**
25
+ * Controls Base.
26
+ * @default true
27
+ */
28
+ base?: boolean | ConfigWithOverrides;
42
29
  /**
43
30
  * Controls React plugin.
44
31
  * @default true - If you have `react` or `react-dom` in your dependencies.
45
32
  */
46
- react?: boolean | { additionalEffectHooks?: string };
33
+ react?: boolean | ReactOptions;
47
34
  /**
35
+ * Controls [Perfectionist plugin](https://www.npmjs.com/package/eslint-plugin-perfectionist).
48
36
  * @default true
49
37
  */
50
- sort?: boolean;
38
+ sort?: boolean | ConfigWithOverrides;
51
39
  /**
52
40
  * Controls Next plugin.
53
41
  * @default true - If you have `next` in your dependencies.
54
42
  */
55
- next?: boolean;
43
+ next?: boolean | ConfigWithOverrides;
56
44
  /**
57
45
  * Controls Tailwind plugin.
58
46
  * @default false
59
47
  * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md
60
48
  */
61
- tailwind?: false | TailwindConfig;
49
+ tailwind?: false | TailwindOptions;
62
50
  /**
63
51
  * Controls [Node plugin](https://www.npmjs.com/package/eslint-plugin-n).
64
52
  * @default false
65
53
  */
66
- node?: boolean;
54
+ node?: boolean | ConfigWithOverrides;
67
55
  /**
68
56
  * Enables all strict rules.
69
57
  * @default false
@@ -73,7 +61,7 @@ export interface Options extends Linter.Config {
73
61
  * Controls [import plugin](https://www.npmjs.com/package/eslint-plugin-import-x).
74
62
  * @default true
75
63
  */
76
- import?: boolean | { internalRegExp?: string; lifetime?: number; projects?: string | string[] };
64
+ import?: boolean | ImportOptions;
77
65
  /**
78
66
  * @default true - If you have `type: module` in your `package.json`.
79
67
  */
@@ -82,42 +70,57 @@ export interface Options extends Linter.Config {
82
70
  * Controls [test plugin](https://www.npmjs.com/package/eslint-plugin-jest-formatting).
83
71
  * @default true - If you have one of `jest`, `vitest`, `cypress`, `@playwright/test` in your dependencies.
84
72
  */
85
- test?: boolean;
73
+ test?: boolean | ConfigWithOverrides;
86
74
  /**
87
75
  * Controls [Jest plugin](https://www.npmjs.com/package/eslint-plugin-jest).
88
76
  * @default true - If you have `jest` in your dependencies.
89
77
  */
90
- jest?: boolean;
78
+ jest?: boolean | ConfigWithOverrides;
91
79
  /**
92
80
  * Controls [Vitest plugin](https://www.npmjs.com/package/eslint-plugin-vitest).
93
81
  * @default true - If you have `vitest` in your dependencies.
94
82
  */
95
- vitest?: boolean;
83
+ vitest?: boolean | ConfigWithOverrides;
96
84
  /**
97
85
  * Controls [Cypress plugin](https://www.npmjs.com/package/eslint-plugin-cypress).
98
86
  * @default true - If you have `cypress` in your dependencies.
99
87
  */
100
- cypress?: boolean;
88
+ cypress?: boolean | ConfigWithOverrides;
101
89
  /**
102
90
  * Controls [Storybook plugin](https://www.npmjs.com/package/eslint-plugin-storybook).
103
91
  * @default true if you have `storybook` in your dependencies.
104
92
  */
105
- storybook?: boolean;
93
+ storybook?: boolean | ConfigWithOverrides;
106
94
  /**
107
95
  * Controls [Prettier plugin](https://www.npmjs.com/package/eslint-plugin-prettier).
108
96
  * @default true - If you have `prettier` in your dependencies.
109
97
  */
110
- prettier?: boolean;
98
+ prettier?: boolean | ConfigWithOverrides;
111
99
  /**
112
100
  * Controls [Playwright plugin](https://www.npmjs.com/package/eslint-plugin-playwright).
113
101
  * @default true - If you have `@playwright/test` in your dependencies.
114
102
  */
115
- playwright?: boolean;
103
+ playwright?: boolean | ConfigWithOverrides;
104
+ /**
105
+ * Controls [Promise plugin](https://www.npmjs.com/package/eslint-plugin-promise).
106
+ * @default true
107
+ */
108
+ promise?: boolean | ConfigWithOverrides;
109
+ /**
110
+ * Controls [Stylistic plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin).
111
+ * @default true
112
+ */
113
+ stylistic?: boolean | ConfigWithOverrides;
116
114
  /**
117
115
  * Controls [TypeScript plugin](https://www.npmjs.com/package/typescript-eslint).
118
116
  * @default true - If you have `typescript` in your dependencies.
119
117
  */
120
- typescript?: boolean | { projectService?: boolean | ProjectServiceOptions; tsconfigRootDir?: string; cacheLifetime?: number };
118
+ typescript?: boolean | TypeScriptOptions;
119
+ /**
120
+ * Controls [Regex plugin](https://www.npmjs.com/package/eslint-plugin-regexp).
121
+ * @default { allowedCharacterRanges: ['all'] }
122
+ */
123
+ regex?: boolean | RegexOptions;
121
124
  /**
122
125
  * Disables expensive rules.
123
126
  * @default false
@@ -133,11 +136,6 @@ export interface Options extends Linter.Config {
133
136
  * @default './.gitignore'
134
137
  */
135
138
  gitignore?: string | false;
136
- /**
137
- * Controls regex plugin.
138
- * @default { allowedCharacterRanges: ['all'] }
139
- */
140
- regex?: boolean | { allowedCharacterRanges: string[] };
141
139
  }
142
140
 
143
141
  export declare function defineConfig(initOptions?: Options, ...extend: Linter.Config[]): Linter.Config[];
@@ -0,0 +1,7 @@
1
+ import type { ConfigWithOverrides } from '..';
2
+
3
+ interface ImportOptions extends ConfigWithOverrides {
4
+ internalRegExp?: string;
5
+ lifetime?: number;
6
+ projects?: string | string[];
7
+ }
@@ -0,0 +1,5 @@
1
+ import type { ConfigWithOverrides } from '..';
2
+
3
+ interface ReactOptions extends ConfigWithOverrides {
4
+ additionalEffectHooks?: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { ConfigWithOverrides } from '..';
2
+
3
+ interface RegexOptions extends ConfigWithOverrides {
4
+ allowedCharacterRanges: string[];
5
+ }
@@ -0,0 +1,20 @@
1
+ import type { ConfigWithOverrides } from '..';
2
+
3
+ interface TailwindOptionsBase extends ConfigWithOverrides {
4
+ callees?: string[];
5
+ variables?: string[];
6
+ attributes?: string[];
7
+ tags?: string[];
8
+ }
9
+
10
+ interface TailwindOptionsWithEntryPoint extends TailwindOptionsBase {
11
+ entryPoint: string;
12
+ tailwindConfig?: string;
13
+ }
14
+
15
+ interface TailwindOptionsWithConfig extends TailwindOptionsBase {
16
+ entryPoint?: string;
17
+ tailwindConfig: string;
18
+ }
19
+
20
+ type TailwindOptions = TailwindOptionsWithConfig | TailwindOptionsWithEntryPoint;
@@ -0,0 +1,38 @@
1
+ import type { ConfigWithOverrides } from '..';
2
+
3
+ /**
4
+ * Granular options to configure the project service.
5
+ */
6
+ interface ProjectServiceOptions {
7
+ /**
8
+ * Globs of files to allow running with the default project compiler options
9
+ * despite not being matched by the project service.
10
+ */
11
+ allowDefaultProject?: string[];
12
+
13
+ /**
14
+ * Path to a TSConfig to use instead of TypeScript's default project configuration.
15
+ * @default 'tsconfig.json'
16
+ */
17
+ defaultProject?: string;
18
+
19
+ /**
20
+ * Whether to allow TypeScript plugins as configured in the TSConfig.
21
+ */
22
+ loadTypeScriptPlugins?: boolean;
23
+
24
+ /**
25
+ * The maximum number of files {@link allowDefaultProject} may match.
26
+ * Each file match slows down linting, so if you do need to use this, please
27
+ * file an informative issue on typescript-eslint explaining why - so we can
28
+ * help you avoid using it!
29
+ * @default 8
30
+ */
31
+ maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING?: number;
32
+ }
33
+
34
+ interface TypeScriptOptions extends ConfigWithOverrides {
35
+ projectService?: boolean | ProjectServiceOptions;
36
+ tsconfigRootDir?: string;
37
+ cacheLifetime?: number;
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "14.4.0",
3
+ "version": "14.6.0",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
@@ -34,7 +34,7 @@
34
34
  ".": {
35
35
  "import": "./src/index.mjs",
36
36
  "require": "./cjs/index.js",
37
- "types": "./src/index.d.ts"
37
+ "types": "./src/types/index.d.ts"
38
38
  }
39
39
  },
40
40
  "dependencies": {
@@ -44,6 +44,7 @@
44
44
  "@stylistic/eslint-plugin": "5.10.0",
45
45
  "@vitest/eslint-plugin": "1.6.17",
46
46
  "deepmerge": "4.3.1",
47
+ "eslint-flat-config-utils": "3.2.0",
47
48
  "eslint-plugin-better-tailwindcss": "4.5.0",
48
49
  "eslint-plugin-cypress": "6.4.1",
49
50
  "eslint-plugin-import-x": "4.16.2",
package/src/index.mjs CHANGED
@@ -12,6 +12,7 @@ import node from './modules/node.mjs';
12
12
  import perfectionist from './modules/perfectionist.mjs';
13
13
  import playwright from './modules/playwright.mjs';
14
14
  import prettier from './modules/prettier.mjs';
15
+ import promise from './modules/promise.mjs';
15
16
  import react from './modules/react.mjs';
16
17
  import regex from './modules/regex.mjs';
17
18
  import storybook from './modules/storybook.mjs';
@@ -25,11 +26,14 @@ const testPackages = ['jest', 'vitest', 'cypress', '@playwright/test'];
25
26
 
26
27
  /**
27
28
  * @typedef {import('eslint').Linter.Config} Config
28
- * @typedef {import('.').Options} Options
29
+ * @typedef {import('./types').Options} Options
29
30
  * /
30
31
 
31
32
  /** @type {Options} */
32
33
  const defaultOptions = {
34
+ base: true,
35
+ promise: true,
36
+ stylistic: true,
33
37
  cypress: isPackageExists('cypress'),
34
38
  disableExpensiveRules: false,
35
39
  esm: false,
@@ -74,6 +78,9 @@ export function defineConfig(initOptions = {}, ...extend) {
74
78
  }
75
79
 
76
80
  const {
81
+ base: enableBase,
82
+ promise: enablePromise,
83
+ stylistic: enableStylistic,
77
84
  sort: enableSort,
78
85
  cypress: enableCypress,
79
86
  disableExpensiveRules,
@@ -97,8 +104,11 @@ export function defineConfig(initOptions = {}, ...extend) {
97
104
  ...eslintOptions
98
105
  } = options;
99
106
 
100
- const rules = [ignores(options), base(options), stylistic(options)];
107
+ const rules = [ignores(options)];
101
108
 
109
+ if (enableBase) rules.push(base(options));
110
+ if (enablePromise) rules.push(promise(options));
111
+ if (enableStylistic) rules.push(stylistic(options));
102
112
  if (enableSort) rules.push(perfectionist(options));
103
113
  if (enableImport) rules.push(imports(options));
104
114
  if (enableTailwind) rules.push(tailwind(options));
@@ -1,13 +1,15 @@
1
+ import { mergeConfigs } from 'eslint-flat-config-utils';
1
2
  import globals from 'globals';
2
3
 
3
4
  import { strict } from '../utils/conditions.mjs';
4
5
 
5
6
  /**
6
- * @param { import('..').Options } options
7
+ * @param { import('../types').Options } options
7
8
  * @return { import('eslint').Linter.Config }
8
9
  */
9
10
  function base(options = {}) {
10
- return {
11
+ const baseConfig = {
12
+ name: 'base',
11
13
  languageOptions: {
12
14
  ecmaVersion: 'latest',
13
15
  sourceType: 'module',
@@ -194,6 +196,8 @@ function base(options = {}) {
194
196
  'no-console': strict(options, 'warn'),
195
197
  },
196
198
  };
199
+
200
+ return mergeConfigs(baseConfig, options.base.overrides ?? {});
197
201
  }
198
202
 
199
203
  export default base;
@@ -1,10 +1,15 @@
1
+ import { mergeConfigs } from 'eslint-flat-config-utils';
1
2
  import plugin from 'eslint-plugin-cypress';
2
3
 
3
4
  import { globs } from '../utils/globs.mjs';
4
5
 
5
- /** @return { import('eslint').Linter.Config } */
6
- function cypress() {
7
- return {
6
+ /**
7
+ * @param { import('../types').Options } options
8
+ * @return { import('eslint').Linter.Config }
9
+ */
10
+ function cypress(options = {}) {
11
+ const cypressConfig = {
12
+ name: 'cypress',
8
13
  files: globs.e2e,
9
14
  plugins: { cypress: plugin },
10
15
  rules: {
@@ -20,6 +25,8 @@ function cypress() {
20
25
  '@typescript-eslint/no-namespace': 'off',
21
26
  },
22
27
  };
28
+
29
+ return mergeConfigs(cypressConfig, options.cypress.overrides ?? {});
23
30
  }
24
31
 
25
32
  export default cypress;
@@ -4,7 +4,7 @@ import { getGitignorePatterns } from '../utils/getGitignorePatterns.mjs';
4
4
  import { ignoreGlobs } from '../utils/globs.mjs';
5
5
 
6
6
  /**
7
- * @param { import('..').Options } options
7
+ * @param { import('../types').Options } options
8
8
  * @return { import('eslint').Linter.Config }
9
9
  */
10
10
  function ignores(options = {}) {
@@ -1,3 +1,4 @@
1
+ import { mergeConfigs } from 'eslint-flat-config-utils';
1
2
  import plugin from 'eslint-plugin-import-x';
2
3
 
3
4
  import { predicate } from '../utils/conditions.mjs';
@@ -7,13 +8,14 @@ const jsExtensions = ['.mjs', '.js', '.jsx', '.cjs'];
7
8
  const allExtensions = [...jsExtensions, ...tsExtensions];
8
9
 
9
10
  /**
10
- * @param { import('..').Options } options
11
+ * @param { import('../types').Options } options
11
12
  * @return { import('eslint').Linter.Config }
12
13
  */
13
14
  function imports(options = {}) {
14
15
  const isObject = typeof options.import === 'object';
15
16
 
16
- const config = {
17
+ const importsConfig = {
18
+ name: 'imports',
17
19
  plugins: { import: plugin },
18
20
  settings: {
19
21
  'import-x/extensions': jsExtensions,
@@ -104,7 +106,7 @@ function imports(options = {}) {
104
106
  },
105
107
  };
106
108
 
107
- return config;
109
+ return mergeConfigs(importsConfig, options.import.overrides ?? {});
108
110
  }
109
111
 
110
112
  export default imports;
@@ -1,3 +1,4 @@
1
+ import { mergeConfigs } from 'eslint-flat-config-utils';
1
2
  import plugin from 'eslint-plugin-jest';
2
3
  import globals from 'globals';
3
4
 
@@ -5,12 +6,13 @@ import { predicate } from '../utils/conditions.mjs';
5
6
  import { globs } from '../utils/globs.mjs';
6
7
 
7
8
  /**
8
- * @param { import('..').Options } options
9
+ * @param { import('../types').Options } options
9
10
  * @return { import('eslint').Linter.Config } */
10
11
  function jest(options = {}) {
11
12
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
12
13
 
13
- return {
14
+ const jestConfig = {
15
+ name: 'jest',
14
16
  files: globs.test,
15
17
  plugins: { jest: plugin },
16
18
  languageOptions: {
@@ -83,6 +85,8 @@ function jest(options = {}) {
83
85
  // }),
84
86
  },
85
87
  };
88
+
89
+ return mergeConfigs(jestConfig, options.jest.overrides ?? {});
86
90
  }
87
91
 
88
92
  export default jest;