@fullstacksjs/eslint-config 14.6.0 → 14.7.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 (48) hide show
  1. package/README.md +1 -1
  2. package/cjs/modules/base.js +3 -1
  3. package/cjs/modules/cypress.js +3 -1
  4. package/cjs/modules/imports.js +3 -1
  5. package/cjs/modules/jest.js +3 -1
  6. package/cjs/modules/next.js +3 -1
  7. package/cjs/modules/node.js +4 -2
  8. package/cjs/modules/perfectionist.js +3 -1
  9. package/cjs/modules/playwright.js +3 -1
  10. package/cjs/modules/prettier.js +3 -7
  11. package/cjs/modules/promise.js +3 -1
  12. package/cjs/modules/react.js +45 -28
  13. package/cjs/modules/regex.js +8 -2
  14. package/cjs/modules/storybook.js +3 -1
  15. package/cjs/modules/stylistic.js +3 -1
  16. package/cjs/modules/tailwind.js +10 -3
  17. package/cjs/modules/tests.js +3 -1
  18. package/cjs/modules/typescript.js +4 -12
  19. package/cjs/modules/vitest.js +3 -2
  20. package/cjs/types/modules/react.d.ts +5 -0
  21. package/cjs/types/modules/regex.d.ts +1 -1
  22. package/cjs/types/modules/tailwind.d.ts +2 -9
  23. package/cjs/utils/nextAllowExportNames.js +7 -0
  24. package/cjs/utils/objectOrEmpty.js +14 -0
  25. package/package.json +13 -13
  26. package/src/modules/base.mjs +4 -1
  27. package/src/modules/cypress.mjs +4 -1
  28. package/src/modules/imports.mjs +3 -1
  29. package/src/modules/jest.mjs +3 -1
  30. package/src/modules/next.mjs +5 -1
  31. package/src/modules/node.mjs +5 -2
  32. package/src/modules/perfectionist.mjs +5 -1
  33. package/src/modules/playwright.mjs +4 -1
  34. package/src/modules/prettier.mjs +5 -7
  35. package/src/modules/promise.mjs +4 -1
  36. package/src/modules/react.mjs +48 -27
  37. package/src/modules/regex.mjs +10 -2
  38. package/src/modules/storybook.mjs +4 -1
  39. package/src/modules/stylistic.mjs +5 -1
  40. package/src/modules/tailwind.mjs +12 -4
  41. package/src/modules/tests.mjs +4 -1
  42. package/src/modules/typescript.mjs +3 -8
  43. package/src/modules/vitest.mjs +4 -2
  44. package/src/types/modules/react.d.ts +5 -0
  45. package/src/types/modules/regex.d.ts +1 -1
  46. package/src/types/modules/tailwind.d.ts +2 -9
  47. package/src/utils/nextAllowExportNames.mjs +17 -0
  48. package/src/utils/objectOrEmpty.mjs +8 -0
package/README.md CHANGED
@@ -242,12 +242,12 @@ export default defineConfig({
242
242
  - [eslint-plugin-playwright](https://github.com/playwright-community/eslint-plugin-playwright)
243
243
  - [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
244
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
245
  - [eslint-plugin-storybook](https://github.com/storybookjs/eslint-plugin-storybook#readme)
247
246
  - [eslint-plugin-better-tailwindcss](https://github.com/schoero/eslint-plugin-better-tailwindcss)
248
247
  - [typescript-eslint](https://typescript-eslint.io)
249
248
  - [eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp)
250
249
  - [eslint-flat-config-utils](https://www.npmjs.com/package/eslint-flat-config-utils)
250
+ - [eslint-plugin-react-refresh](https://www.npmjs.com/package/eslint-plugin-react-refresh)
251
251
 
252
252
  That's all. Feel free to use 💛
253
253
 
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _globals = _interopRequireDefault(require("globals"));
9
9
  var _conditions = require("../utils/conditions.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../types').Options } options
13
14
  * @return { import('eslint').Linter.Config }
14
15
  */
15
16
  function base(options = {}) {
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.base.overrides);
16
18
  const baseConfig = {
17
19
  name: 'base',
18
20
  languageOptions: {
@@ -226,6 +228,6 @@ function base(options = {}) {
226
228
  'no-console': (0, _conditions.strict)(options, 'warn')
227
229
  }
228
230
  };
229
- return (0, _eslintFlatConfigUtils.mergeConfigs)(baseConfig, options.base.overrides ?? {});
231
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(baseConfig, overrides);
230
232
  }
231
233
  module.exports = base;
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginCypress = _interopRequireDefault(require("eslint-plugin-cypress"));
9
9
  var _globs = require("../utils/globs.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../types').Options } options
13
14
  * @return { import('eslint').Linter.Config }
14
15
  */
15
16
  function cypress(options = {}) {
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.cypress.overrides);
16
18
  const cypressConfig = {
17
19
  name: 'cypress',
18
20
  files: _globs.globs.e2e,
@@ -32,6 +34,6 @@ function cypress(options = {}) {
32
34
  '@typescript-eslint/no-namespace': 'off'
33
35
  }
34
36
  };
35
- return (0, _eslintFlatConfigUtils.mergeConfigs)(cypressConfig, options.cypress.overrides ?? {});
37
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(cypressConfig, overrides);
36
38
  }
37
39
  module.exports = cypress;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginImportX = _interopRequireDefault(require("eslint-plugin-import-x"));
9
9
  var _conditions = require("../utils/conditions.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  const tsExtensions = ['.ts', '.tsx', '.cts', '.mts', '.ctsx', '.mtsx'];
12
13
  const jsExtensions = ['.mjs', '.js', '.jsx', '.cjs'];
@@ -18,6 +19,7 @@ const allExtensions = [...jsExtensions, ...tsExtensions];
18
19
  */
19
20
  function imports(options = {}) {
20
21
  const isObject = typeof options.import === 'object';
22
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.import.overrides);
21
23
  const importsConfig = {
22
24
  name: 'imports',
23
25
  plugins: {
@@ -117,6 +119,6 @@ function imports(options = {}) {
117
119
  })
118
120
  }
119
121
  };
120
- return (0, _eslintFlatConfigUtils.mergeConfigs)(importsConfig, options.import.overrides ?? {});
122
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(importsConfig, overrides);
121
123
  }
122
124
  module.exports = imports;
@@ -9,12 +9,14 @@ var _eslintPluginJest = _interopRequireDefault(require("eslint-plugin-jest"));
9
9
  var _globals = _interopRequireDefault(require("globals"));
10
10
  var _conditions = require("../utils/conditions.js");
11
11
  var _globs = require("../utils/globs.js");
12
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
14
  /**
14
15
  * @param { import('../types').Options } options
15
16
  * @return { import('eslint').Linter.Config } */
16
17
  function jest(options = {}) {
17
18
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
19
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.jest.overrides);
18
20
  const jestConfig = {
19
21
  name: 'jest',
20
22
  files: _globs.globs.test,
@@ -95,6 +97,6 @@ function jest(options = {}) {
95
97
  // }),
96
98
  }
97
99
  };
98
- return (0, _eslintFlatConfigUtils.mergeConfigs)(jestConfig, options.jest.overrides ?? {});
100
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(jestConfig, overrides);
99
101
  }
100
102
  module.exports = jest;
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _eslintPluginNext = _interopRequireDefault(require("@next/eslint-plugin-next"));
8
8
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
9
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
11
12
  * @param { import('../types').Options } options
12
13
  * @return { import('eslint').Linter.Config }
13
14
  */
14
15
  function next(options = {}) {
16
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.next.overrides);
15
17
  const nextConfig = {
16
18
  name: 'next',
17
19
  plugins: {
@@ -41,6 +43,6 @@ function next(options = {}) {
41
43
  'next/no-unwanted-polyfillio': 'warn'
42
44
  }
43
45
  };
44
- return (0, _eslintFlatConfigUtils.mergeConfigs)(nextConfig, options.next.overrides ?? {});
46
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(nextConfig, overrides);
45
47
  }
46
48
  module.exports = next;
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginN = _interopRequireDefault(require("eslint-plugin-n"));
9
9
  var _conditions = require("../utils/conditions.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../types').Options } options
13
14
  * @return { import('eslint').Linter.Config }
14
15
  */
15
16
  function node(options = {}) {
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.node.overrides);
16
18
  const nodeConfig = {
17
19
  name: 'node',
18
20
  plugins: {
@@ -40,7 +42,7 @@ function node(options = {}) {
40
42
  'n/no-sync': (0, _conditions.strict)(options, 'warn'),
41
43
  'n/no-top-level-await': 'off',
42
44
  'n/no-unpublished-bin': 'warn',
43
- 'n/no-unpublished-import': 'warn',
45
+ 'n/no-unpublished-import': 'off',
44
46
  'n/no-unpublished-require': 'warn',
45
47
  'n/no-unsupported-features/es-builtins': 'off',
46
48
  // Nice but not a general rule
@@ -69,6 +71,6 @@ function node(options = {}) {
69
71
  'n/no-missing-require': 'off'
70
72
  }
71
73
  };
72
- return (0, _eslintFlatConfigUtils.mergeConfigs)(nodeConfig, options.node.overrides ?? {});
74
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(nodeConfig, overrides);
73
75
  }
74
76
  module.exports = node;
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginPerfectionist = _interopRequireDefault(require("eslint-plugin-perfectionist"));
9
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
11
12
  * @param { import('../types').Options } options
12
13
  * @return { Promise<import('eslint').Linter.Config> }
13
14
  */
14
15
  function perfectionist(options = {}) {
16
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.sort.overrides);
15
17
  const perfectionistConfig = {
16
18
  name: 'perfectionist',
17
19
  plugins: {
@@ -47,6 +49,6 @@ function perfectionist(options = {}) {
47
49
  'perfectionist/sort-variable-declarations': 'warn'
48
50
  }
49
51
  };
50
- return (0, _eslintFlatConfigUtils.mergeConfigs)(perfectionistConfig, options.sort.overrides ?? {});
52
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(perfectionistConfig, overrides);
51
53
  }
52
54
  module.exports = perfectionist;
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginPlaywright = _interopRequireDefault(require("eslint-plugin-playwright"));
9
9
  var _globs = require("../utils/globs.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../types').Options } options
13
14
  * @return { Promise<import('eslint').Linter.Config> }
14
15
  */
15
16
  function playwright(options = {}) {
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.playwright.overrides);
16
18
  const playwrightConfig = {
17
19
  name: 'playwright',
18
20
  plugins: {
@@ -82,6 +84,6 @@ function playwright(options = {}) {
82
84
  'playwright/valid-title': 'warn'
83
85
  }
84
86
  };
85
- return (0, _eslintFlatConfigUtils.mergeConfigs)(playwrightConfig, options.playwright.overrides ?? {});
87
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(playwrightConfig, overrides);
86
88
  }
87
89
  module.exports = playwright;
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginPrettier = _interopRequireDefault(require("eslint-plugin-prettier"));
9
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
11
12
  * @param { import('../types').Options } options
12
13
  * @return { Promise<import('eslint').Linter.Config> }
13
14
  */
14
15
  function prettier(options = {}) {
16
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.prettier.overrides);
15
17
  const prettierConfig = {
16
18
  name: 'prettier',
17
19
  plugins: {
@@ -20,23 +22,19 @@ function prettier(options = {}) {
20
22
  rules: {
21
23
  'prettier/prettier': 'error',
22
24
  'curly': 'off',
23
- 'brace-style': 'off',
24
25
  'no-unexpected-multiline': 'off',
25
26
  '@typescript-eslint/lines-around-comment': 'off',
26
27
  '@typescript-eslint/quotes': 'off',
27
28
  '@typescript-eslint/block-spacing': 'off',
28
- '@typescript-eslint/brace-style': 'off',
29
29
  '@typescript-eslint/comma-dangle': 'off',
30
30
  '@typescript-eslint/comma-spacing': 'off',
31
31
  '@typescript-eslint/func-call-spacing': 'off',
32
32
  '@typescript-eslint/indent': 'off',
33
- '@typescript-eslint/key-spacing': 'off',
34
33
  '@typescript-eslint/keyword-spacing': 'off',
35
34
  '@typescript-eslint/member-delimiter-style': 'off',
36
35
  '@typescript-eslint/no-extra-parens': 'off',
37
36
  '@typescript-eslint/no-extra-semi': 'off',
38
37
  '@typescript-eslint/semi': 'off',
39
- '@typescript-eslint/space-before-blocks': 'off',
40
38
  '@typescript-eslint/space-before-function-paren': 'off',
41
39
  '@typescript-eslint/space-infix-ops': 'off',
42
40
  '@typescript-eslint/type-annotation-spacing': 'off',
@@ -47,12 +45,10 @@ function prettier(options = {}) {
47
45
  '@stylistic/jsx-curly-spacing': 'off',
48
46
  '@stylistic/jsx-equals-spacing': 'off',
49
47
  '@stylistic/jsx-first-prop-new-line': 'off',
50
- '@stylistic/jsx-indent': 'off',
51
48
  '@stylistic/jsx-indent-props': 'off',
52
49
  '@stylistic/jsx-max-props-per-line': 'off',
53
50
  '@stylistic/jsx-newline': 'off',
54
51
  '@stylistic/jsx-one-expression-per-line': 'off',
55
- '@stylistic/jsx-props-no-multi-spaces': 'off',
56
52
  '@stylistic/jsx-tag-spacing': 'off',
57
53
  '@stylistic/jsx-wrap-multilines': 'off',
58
54
  'vue/html-self-closing': 'off',
@@ -96,6 +92,6 @@ function prettier(options = {}) {
96
92
  'vue/template-curly-spacing': 'off'
97
93
  }
98
94
  };
99
- return (0, _eslintFlatConfigUtils.mergeConfigs)(prettierConfig, options.prettier.overrides ?? {});
95
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(prettierConfig, overrides);
100
96
  }
101
97
  module.exports = prettier;
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginPromise = _interopRequireDefault(require("eslint-plugin-promise"));
9
9
  var _conditions = require("../utils/conditions.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../types').Options } options
13
14
  * @return { Promise<import('eslint').Linter.Config> }
14
15
  */
15
16
  function promise(options = {}) {
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.promise.overrides);
16
18
  const promiseConfig = {
17
19
  name: 'promise',
18
20
  plugins: {
@@ -38,6 +40,6 @@ function promise(options = {}) {
38
40
  'promise/spec-only': 'warn'
39
41
  }
40
42
  };
41
- return (0, _eslintFlatConfigUtils.mergeConfigs)(promiseConfig, options.promise.overrides ?? {});
43
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(promiseConfig, overrides);
42
44
  }
43
45
  module.exports = promise;
@@ -7,10 +7,13 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintPlugin = _interopRequireDefault(require("@eslint-react/eslint-plugin"));
8
8
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
9
9
  var _eslintPluginJsxA11y = _interopRequireDefault(require("eslint-plugin-jsx-a11y"));
10
- var _eslintPluginReactHooks = _interopRequireDefault(require("eslint-plugin-react-hooks"));
10
+ var _eslintPluginReactRefresh = require("eslint-plugin-react-refresh");
11
+ var _localPkg = require("local-pkg");
11
12
  var _typescriptEslint = require("typescript-eslint");
12
13
  var _conditions = require("../utils/conditions.js");
13
14
  var _globs = require("../utils/globs.js");
15
+ var _nextAllowExportNames = require("../utils/nextAllowExportNames.js");
16
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
14
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
18
  /**
16
19
  * @param { import('../types').Options } options
@@ -18,13 +21,15 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
18
21
  */
19
22
  function react(options = {}) {
20
23
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
24
+ const isObject = typeof options.react === 'object';
25
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.react.overrides);
21
26
  const reactConfig = {
22
27
  name: 'react',
23
28
  files: [_globs.globs.js, _globs.globs.jsx, _globs.globs.ts, _globs.globs.tsx],
24
29
  plugins: {
25
30
  ..._eslintPlugin.default.configs.all.plugins,
26
- 'react-hooks': _eslintPluginReactHooks.default,
27
- 'jsx-a11y': _eslintPluginJsxA11y.default
31
+ 'jsx-a11y': _eslintPluginJsxA11y.default,
32
+ 'react-refresh': _eslintPluginReactRefresh.reactRefresh.plugin
28
33
  },
29
34
  ...(0, _conditions.predicate)(projectService, {
30
35
  languageOptions: {
@@ -35,12 +40,25 @@ function react(options = {}) {
35
40
  }
36
41
  }),
37
42
  settings: {
38
- 'react': {
39
- pragma: 'React',
40
- version: 'detect'
41
- },
42
- 'react-hooks': {
43
- additionalEffectHooks: options.react.additionalEffectHooks
43
+ 'react-x': {
44
+ ...(0, _conditions.predicate)(isObject && 'version' in options.react, {
45
+ version: options.react.version
46
+ }),
47
+ ...(0, _conditions.predicate)(isObject && 'importSource' in options.react, {
48
+ importSource: options.react.importSource
49
+ }),
50
+ ...(0, _conditions.predicate)(isObject && 'compilationMode' in options.react, {
51
+ compilationMode: options.react.compilationMode
52
+ }),
53
+ ...(0, _conditions.predicate)(isObject && 'polymorphicPropName' in options.react, {
54
+ polymorphicPropName: options.react.polymorphicPropName
55
+ }),
56
+ ...(0, _conditions.predicate)(isObject && 'additionalStateHooks' in options.react, {
57
+ additionalStateHooks: options.react.additionalStateHooks
58
+ }),
59
+ ...(0, _conditions.predicate)(isObject && 'additionalEffectHooks' in options.react, {
60
+ additionalEffectHooks: options.react.additionalEffectHooks
61
+ })
44
62
  }
45
63
  },
46
64
  rules: {
@@ -112,23 +130,18 @@ function react(options = {}) {
112
130
  '@eslint-react/web-api-no-leaked-resize-observer': 'error',
113
131
  '@eslint-react/web-api-no-leaked-fetch': 'error',
114
132
  '@eslint-react/rsc-function-definition': 'error',
115
- 'react-hooks/rules-of-hooks': 'error',
116
- 'react-hooks/exhaustive-deps': 'warn',
117
- 'react-hooks/config': 'error',
118
- 'react-hooks/error-boundaries': 'error',
119
- 'react-hooks/component-hook-factories': 'error',
120
- 'react-hooks/gating': 'error',
121
- 'react-hooks/globals': 'error',
122
- 'react-hooks/immutability': 'error',
123
- 'react-hooks/preserve-manual-memoization': 'error',
124
- 'react-hooks/purity': 'error',
125
- 'react-hooks/refs': 'error',
126
- 'react-hooks/set-state-in-effect': (0, _conditions.strict)('error'),
127
- 'react-hooks/set-state-in-render': 'error',
128
- 'react-hooks/static-components': (0, _conditions.strict)('error'),
129
- 'react-hooks/unsupported-syntax': 'warn',
130
- 'react-hooks/use-memo': 'error',
131
- 'react-hooks/incompatible-library': 'warn',
133
+ '@eslint-react/rules-of-hooks': 'error',
134
+ '@eslint-react/exhaustive-deps': 'error',
135
+ '@eslint-react/error-boundaries': 'error',
136
+ '@eslint-react/globals': 'error',
137
+ '@eslint-react/immutability': 'error',
138
+ '@eslint-react/purity': 'error',
139
+ '@eslint-react/refs': 'error',
140
+ '@eslint-react/set-state-in-effect': (0, _conditions.strict)('error'),
141
+ '@eslint-react/set-state-in-render': 'error',
142
+ '@eslint-react/static-components': (0, _conditions.strict)('error'),
143
+ '@eslint-react/unsupported-syntax': 'error',
144
+ '@eslint-react/use-memo': 'error',
132
145
  'jsx-a11y/alt-text': 'warn',
133
146
  'jsx-a11y/anchor-has-content': 'error',
134
147
  'jsx-a11y/anchor-is-valid': 'error',
@@ -164,9 +177,13 @@ function react(options = {}) {
164
177
  'jsx-a11y/scope': 'error',
165
178
  'jsx-a11y/tabindex-no-positive': 'warn',
166
179
  'jsx-a11y/anchor-ambiguous-text': 'off',
167
- 'jsx-a11y/prefer-tag-over-role': 'off'
180
+ 'jsx-a11y/prefer-tag-over-role': 'off',
181
+ 'react-refresh/only-export-components': ['error', {
182
+ allowExportNames: (0, _localPkg.isPackageExists)('next') ? _nextAllowExportNames.nextAllowExportNames : [],
183
+ allowConstantExport: (0, _localPkg.isPackageExists)('vite')
184
+ }]
168
185
  }
169
186
  };
170
- return (0, _eslintFlatConfigUtils.mergeConfigs)(reactConfig, options.react.overrides ?? {});
187
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(reactConfig, overrides);
171
188
  }
172
189
  module.exports = react;
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var plugin = _interopRequireWildcard(require("eslint-plugin-regexp"));
9
+ var _conditions = require("../utils/conditions.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
9
11
  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); }
10
12
  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; }
11
13
  /**
@@ -13,6 +15,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
13
15
  * @return { Promise<import('eslint').Linter.Config> }
14
16
  */
15
17
  function regex(options = {}) {
18
+ const isObject = typeof options.regex === 'object';
19
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.regex.overrides);
16
20
  const regexConfig = {
17
21
  name: 'regex',
18
22
  plugins: {
@@ -20,7 +24,9 @@ function regex(options = {}) {
20
24
  },
21
25
  settings: {
22
26
  regexp: {
23
- allowedCharacterRanges: options.regex.allowedCharacterRanges
27
+ ...(0, _conditions.predicate)(isObject && 'allowedCharacterRanges' in options.regex, {
28
+ allowedCharacterRanges: options.regex.allowedCharacterRanges
29
+ })
24
30
  }
25
31
  },
26
32
  rules: {
@@ -111,6 +117,6 @@ function regex(options = {}) {
111
117
  'no-empty-character-class': 'off'
112
118
  }
113
119
  };
114
- return (0, _eslintFlatConfigUtils.mergeConfigs)(regexConfig, options.regex.overrides ?? {});
120
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(regexConfig, overrides);
115
121
  }
116
122
  module.exports = regex;
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _eslintPluginStorybook = _interopRequireDefault(require("eslint-plugin-storybook"));
9
9
  var _globs = require("../utils/globs.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../types').Options } options
13
14
  * @return { Promise<import('eslint').Linter.Config> }
14
15
  */
15
16
  function storybook(options = {}) {
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.storybook.overrides);
16
18
  const storybookConfig = {
17
19
  name: 'storybook',
18
20
  files: _globs.globs.storybook,
@@ -42,6 +44,6 @@ function storybook(options = {}) {
42
44
  'react-hooks/rules-of-hooks': 'off'
43
45
  }
44
46
  };
45
- return (0, _eslintFlatConfigUtils.mergeConfigs)(storybookConfig, options.storybook.overrides ?? {});
47
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(storybookConfig, overrides);
46
48
  }
47
49
  module.exports = storybook;
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _eslintPlugin = _interopRequireDefault(require("@stylistic/eslint-plugin"));
8
8
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
9
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  /**
11
12
  * @param { import('../types').Options } options
12
13
  * @return { Promise<import('eslint').Linter.Config> }
13
14
  */
14
15
  function stylistic(options = {}) {
16
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.stylistic.overrides);
15
17
  const stylisticConfig = {
16
18
  name: 'stylistic',
17
19
  plugins: {
@@ -87,6 +89,6 @@ function stylistic(options = {}) {
87
89
  }]
88
90
  }
89
91
  };
90
- return (0, _eslintFlatConfigUtils.mergeConfigs)(stylisticConfig, options.stylistic.overrides ?? {});
92
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(stylisticConfig, overrides);
91
93
  }
92
94
  module.exports = stylistic;
@@ -6,12 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
8
8
  var _conditions = require("../utils/conditions.js");
9
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
9
10
  /**
10
11
  * @param { import('../types').Options } options
11
12
  * @return { Promise<import('eslint').Linter.Config> }
12
13
  */
13
14
  async function tailwind(options = {}) {
14
15
  const plugin = await Promise.resolve().then(() => require('eslint-plugin-better-tailwindcss'));
16
+ const isObject = typeof options.tailwind === 'object';
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.tailwind.overrides);
15
18
  const tailwindConfig = {
16
19
  name: 'tailwind',
17
20
  plugins: {
@@ -19,8 +22,12 @@ async function tailwind(options = {}) {
19
22
  },
20
23
  settings: {
21
24
  'better-tailwindcss': {
22
- entryPoint: options.tailwind.entryPoint,
23
- tailwindConfig: options.tailwind.tailwindConfig,
25
+ ...(0, _conditions.predicate)(isObject && 'entryPoint' in options.tailwind, {
26
+ entryPoint: options.tailwind.entryPoint
27
+ }),
28
+ ...(0, _conditions.predicate)(isObject && 'tailwindConfig' in options.tailwind, {
29
+ tailwindConfig: options.tailwind.tailwindConfig
30
+ }),
24
31
  callees: [['^class|classnames|classNames|cva|ctl|clsx|cn|cns|cx|cc|clb|cnb|dcnb|objstr|tv|twJoin|twMerge$', [{
25
32
  match: 'strings'
26
33
  }]]]
@@ -43,6 +50,6 @@ async function tailwind(options = {}) {
43
50
  'better-tailwindcss/no-unnecessary-whitespace': 'warn'
44
51
  }
45
52
  };
46
- return (0, _eslintFlatConfigUtils.mergeConfigs)(tailwindConfig, options.tailwind.overrides ?? {});
53
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(tailwindConfig, overrides);
47
54
  }
48
55
  module.exports = tailwind;
@@ -9,6 +9,7 @@ var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
9
9
  var _globals = _interopRequireDefault(require("globals"));
10
10
  var _conditions = require("../utils/conditions.js");
11
11
  var _globs = require("../utils/globs.js");
12
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
12
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
14
  /**
14
15
  * @param { import('../types').Options } options
@@ -16,6 +17,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
16
17
  */
17
18
 
18
19
  function tests(options = {}) {
20
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.test.overrides);
19
21
  const testsConfug = {
20
22
  name: 'tests',
21
23
  files: [..._globs.globs.test, ..._globs.globs.e2e],
@@ -45,6 +47,6 @@ function tests(options = {}) {
45
47
  })
46
48
  }
47
49
  };
48
- return (0, _eslintFlatConfigUtils.mergeConfigs)(testsConfug, options.test.overrides ?? {});
50
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(testsConfug, overrides);
49
51
  }
50
52
  module.exports = tests;
@@ -9,12 +9,14 @@ var _typescriptEslint = require("typescript-eslint");
9
9
  var _conditions = require("../utils/conditions.js");
10
10
  var _globs = require("../utils/globs.js");
11
11
  var _namingConvention = require("../utils/naming-convention.js");
12
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
12
13
  /**
13
14
  * @param { import('../types').Options } options
14
15
  * @return { import('eslint').Linter.Config }
15
16
  */
16
17
  function typescript(options = {}) {
17
18
  const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
19
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.typescript.overrides);
18
20
  const typescriptConfig = {
19
21
  name: 'typescript',
20
22
  files: [_globs.globs.ts, _globs.globs.tsx],
@@ -155,15 +157,9 @@ function typescript(options = {}) {
155
157
  '@typescript-eslint/restrict-plus-operands': 'warn',
156
158
  '@typescript-eslint/strict-boolean-expressions': 'off',
157
159
  // Annoying
158
- '@typescript-eslint/space-before-blocks': 'off',
160
+
159
161
  '@typescript-eslint/triple-slash-reference': 'error',
160
- '@typescript-eslint/typedef': ['error', {
161
- parameter: false,
162
- arrowParameter: false,
163
- variableDeclaration: false
164
- }],
165
162
  '@typescript-eslint/unified-signatures': 'error',
166
- '@typescript-eslint/key-spacing': 'off',
167
163
  ...(0, _conditions.predicate)(projectService, {
168
164
  '@typescript-eslint/await-thenable': 'error',
169
165
  '@typescript-eslint/consistent-return': 'off',
@@ -258,7 +254,6 @@ function typescript(options = {}) {
258
254
  'import/namespace': 'off',
259
255
  'import/default': 'off',
260
256
  'import/no-named-as-default-member': 'off',
261
- 'key-spacing': 'off',
262
257
  'camelcase': 'off',
263
258
  'default-param-last': 'off',
264
259
  'init-declarations': 'off',
@@ -270,9 +265,6 @@ function typescript(options = {}) {
270
265
  'no-unused-vars': 'off',
271
266
  'no-use-before-define': 'off',
272
267
  'no-useless-constructor': 'off',
273
- 'object-curly-spacing': 'off',
274
- 'padding-line-between-statements': 'off',
275
- 'space-before-blocks': 'off',
276
268
  'dot-notation': 'off',
277
269
  'no-throw-literal': 'off',
278
270
  'require-await': 'off',
@@ -280,6 +272,6 @@ function typescript(options = {}) {
280
272
  'no-duplicate-imports': 'off'
281
273
  }
282
274
  };
283
- return (0, _eslintFlatConfigUtils.mergeConfigs)(typescriptConfig, options.typescript.overrides ?? {});
275
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(typescriptConfig, overrides);
284
276
  }
285
277
  module.exports = typescript;
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintPlugin = _interopRequireDefault(require("@vitest/eslint-plugin"));
8
8
  var _eslintFlatConfigUtils = require("eslint-flat-config-utils");
9
9
  var _globs = require("../utils/globs.js");
10
+ var _objectOrEmpty = require("../utils/objectOrEmpty.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../types').Options } options
13
14
  * @return { import('eslint').Linter.Config }
14
15
  */
15
16
  function vitest(options = {}) {
17
+ const overrides = (0, _objectOrEmpty.objectOrEmpty)(options.vitest.overrides);
16
18
  const vitestConfig = {
17
19
  name: 'vitest',
18
20
  files: _globs.globs.test,
@@ -53,7 +55,6 @@ function vitest(options = {}) {
53
55
  'vitest/no-conditional-in-test': 'off',
54
56
  'vitest/no-conditional-tests': 'warn',
55
57
  'vitest/no-disabled-tests': 'warn',
56
- 'vitest/no-done-callback': 'off',
57
58
  'vitest/no-duplicate-hooks': 'error',
58
59
  'vitest/no-focused-tests': 'warn',
59
60
  'vitest/no-hooks': 'off',
@@ -110,6 +111,6 @@ function vitest(options = {}) {
110
111
  'vitest/warn-todo': 'warn'
111
112
  }
112
113
  };
113
- return (0, _eslintFlatConfigUtils.mergeConfigs)(vitestConfig, options.vitest.overrides ?? {});
114
+ return (0, _eslintFlatConfigUtils.mergeConfigs)(vitestConfig, overrides);
114
115
  }
115
116
  module.exports = vitest;