@fullstacksjs/eslint-config 13.5.0 → 13.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.
package/README.md CHANGED
@@ -50,7 +50,7 @@ You can fine-tune module detection by overriding it, the `defineConfig` function
50
50
 
51
51
  ```typescript
52
52
  interface Options {
53
- react?: boolean; // controls react, react-hooks, jsx/a11y plugins
53
+ react?: boolean | { additionalEffectHooks?: string }; // controls react, react-hooks, jsx/a11y plugins
54
54
  typescript?: ParserOptions // https://typescript-eslint.io/packages/parser#configuration
55
55
  node?: boolean; // controls node plugin
56
56
  sort?: boolean; // controls perfectionist plugin
package/cjs/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export interface Options extends Linter.Config {
19
19
  * Controls React plugin.
20
20
  * @default true - If you have `react` or `react-dom` in your dependencies.
21
21
  */
22
- react?: boolean;
22
+ react?: boolean | { additionalEffectHooks?: string };
23
23
  /**
24
24
  * @default true
25
25
  */
@@ -7,9 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  var _eslintPlugin = _interopRequireDefault(require("@eslint-react/eslint-plugin"));
8
8
  var _eslintPluginJsxA11y = _interopRequireDefault(require("eslint-plugin-jsx-a11y"));
9
9
  var _eslintPluginReactHooks = _interopRequireDefault(require("eslint-plugin-react-hooks"));
10
+ var _conditions = require("../utils/conditions.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /** @return { import('eslint').Linter.Config } */
12
- function react() {
13
+ function react(options = {}) {
14
+ const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
13
15
  return {
14
16
  plugins: {
15
17
  ..._eslintPlugin.default.configs.all.plugins,
@@ -17,9 +19,12 @@ function react() {
17
19
  'jsx-a11y': _eslintPluginJsxA11y.default
18
20
  },
19
21
  settings: {
20
- react: {
22
+ 'react': {
21
23
  pragma: 'React',
22
24
  version: 'detect'
25
+ },
26
+ 'react-hooks': {
27
+ additionalEffectHooks: options.react.additionalEffectHooks
23
28
  }
24
29
  },
25
30
  rules: {
@@ -83,7 +88,9 @@ function react() {
83
88
  '@eslint-react/no-unstable-default-props': 'error',
84
89
  '@eslint-react/no-unused-class-component-members': 'warn',
85
90
  '@eslint-react/no-unused-state': 'warn',
86
- '@eslint-react/no-unused-props': 'off',
91
+ ...(0, _conditions.predicate)(projectService, {
92
+ '@eslint-react/no-unused-props': 'warn'
93
+ }),
87
94
  '@eslint-react/no-useless-forward-ref': 'off',
88
95
  '@eslint-react/no-useless-fragment': 'warn',
89
96
  '@eslint-react/no-use-context': 'warn',
@@ -63,8 +63,6 @@ function typescript(options = {}) {
63
63
  prefix: ['is', 'should', 'has', 'can', 'did', 'will', 'enable', 'loading']
64
64
  }] : [])],
65
65
  '@typescript-eslint/no-array-constructor': 'error',
66
- '@typescript-eslint/no-base-to-string': 'off',
67
- // false negative
68
66
  '@typescript-eslint/no-confusing-non-null-assertion': 'error',
69
67
  '@typescript-eslint/no-dupe-class-members': 'error',
70
68
  '@typescript-eslint/no-duplicate-enum-values': 'error',
@@ -171,6 +169,7 @@ function typescript(options = {}) {
171
169
  allowProtectedClassPropertyAccess: false,
172
170
  allowIndexSignaturePropertyAccess: true
173
171
  }],
172
+ '@typescript-eslint/no-base-to-string': 'error',
174
173
  '@typescript-eslint/no-confusing-void-expression': ['off', {
175
174
  ignoreArrowShorthand: true,
176
175
  ignoreVoidOperator: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "13.5.0",
3
+ "version": "13.7.0",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
@@ -35,7 +35,7 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@eslint-react/eslint-plugin": "2.0.0",
38
+ "@eslint-react/eslint-plugin": "2.0.6",
39
39
  "@eslint/compat": "1.4.0",
40
40
  "@next/eslint-plugin-next": "15.5.4",
41
41
  "@stylistic/eslint-plugin": "5.4.0",
@@ -51,7 +51,7 @@
51
51
  "eslint-plugin-playwright": "2.2.2",
52
52
  "eslint-plugin-prettier": "5.5.4",
53
53
  "eslint-plugin-promise": "7.2.1",
54
- "eslint-plugin-react-hooks": "5.2.0",
54
+ "eslint-plugin-react-hooks": "6.1.1",
55
55
  "eslint-plugin-regexp": "2.10.0",
56
56
  "eslint-plugin-storybook": "0.12.0",
57
57
  "globals": "16.4.0",
package/src/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export interface Options extends Linter.Config {
19
19
  * Controls React plugin.
20
20
  * @default true - If you have `react` or `react-dom` in your dependencies.
21
21
  */
22
- react?: boolean;
22
+ react?: boolean | { additionalEffectHooks?: string };
23
23
  /**
24
24
  * @default true
25
25
  */
@@ -2,8 +2,12 @@ import reactPlugin from '@eslint-react/eslint-plugin';
2
2
  import a11yPlugin from 'eslint-plugin-jsx-a11y';
3
3
  import hooksPlugin from 'eslint-plugin-react-hooks';
4
4
 
5
+ import { predicate } from '../utils/conditions.mjs';
6
+
5
7
  /** @return { import('eslint').Linter.Config } */
6
- function react() {
8
+ function react(options = {}) {
9
+ const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
10
+
7
11
  return {
8
12
  plugins: {
9
13
  ...reactPlugin.configs.all.plugins,
@@ -11,10 +15,13 @@ function react() {
11
15
  'jsx-a11y': a11yPlugin,
12
16
  },
13
17
  settings: {
14
- react: {
18
+ 'react': {
15
19
  pragma: 'React',
16
20
  version: 'detect',
17
21
  },
22
+ 'react-hooks': {
23
+ additionalEffectHooks: options.react.additionalEffectHooks,
24
+ },
18
25
  },
19
26
  rules: {
20
27
  '@eslint-react/dom/no-void-elements-with-children': 'warn',
@@ -79,7 +86,9 @@ function react() {
79
86
  '@eslint-react/no-unstable-default-props': 'error',
80
87
  '@eslint-react/no-unused-class-component-members': 'warn',
81
88
  '@eslint-react/no-unused-state': 'warn',
82
- '@eslint-react/no-unused-props': 'off',
89
+ ...predicate(projectService, {
90
+ '@eslint-react/no-unused-props': 'warn',
91
+ }),
83
92
  '@eslint-react/no-useless-forward-ref': 'off',
84
93
  '@eslint-react/no-useless-fragment': 'warn',
85
94
  '@eslint-react/no-use-context': 'warn',
@@ -68,7 +68,6 @@ function typescript(options = {}) {
68
68
  : []),
69
69
  ],
70
70
  '@typescript-eslint/no-array-constructor': 'error',
71
- '@typescript-eslint/no-base-to-string': 'off', // false negative
72
71
  '@typescript-eslint/no-confusing-non-null-assertion': 'error',
73
72
  '@typescript-eslint/no-dupe-class-members': 'error',
74
73
  '@typescript-eslint/no-duplicate-enum-values': 'error',
@@ -156,6 +155,7 @@ function typescript(options = {}) {
156
155
  allowIndexSignaturePropertyAccess: true,
157
156
  },
158
157
  ],
158
+ '@typescript-eslint/no-base-to-string': 'error',
159
159
  '@typescript-eslint/no-confusing-void-expression': ['off', { ignoreArrowShorthand: true, ignoreVoidOperator: true }], // Annoying and conflict with @typescript-eslint/no-meaningless-void-operator
160
160
  '@typescript-eslint/no-duplicate-type-constituents': 'warn',
161
161
  '@typescript-eslint/no-for-in-array': 'error',