@fullstacksjs/eslint-config 13.6.0 → 13.8.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/cjs/modules/react.js +21 -2
- package/cjs/modules/typescript.js +1 -2
- package/package.json +2 -2
- package/src/modules/react.mjs +24 -2
- package/src/modules/typescript.mjs +1 -1
package/cjs/modules/react.js
CHANGED
|
@@ -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
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,
|
|
@@ -86,7 +88,9 @@ function react(options = {}) {
|
|
|
86
88
|
'@eslint-react/no-unstable-default-props': 'error',
|
|
87
89
|
'@eslint-react/no-unused-class-component-members': 'warn',
|
|
88
90
|
'@eslint-react/no-unused-state': 'warn',
|
|
89
|
-
|
|
91
|
+
...(0, _conditions.predicate)(projectService, {
|
|
92
|
+
'@eslint-react/no-unused-props': 'warn'
|
|
93
|
+
}),
|
|
90
94
|
'@eslint-react/no-useless-forward-ref': 'off',
|
|
91
95
|
'@eslint-react/no-useless-fragment': 'warn',
|
|
92
96
|
'@eslint-react/no-use-context': 'warn',
|
|
@@ -109,8 +113,23 @@ function react(options = {}) {
|
|
|
109
113
|
'@eslint-react/web-api/no-leaked-event-listener': 'error',
|
|
110
114
|
'@eslint-react/web-api/no-leaked-interval': 'error',
|
|
111
115
|
'@eslint-react/web-api/no-leaked-resize-observer': 'error',
|
|
112
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
113
116
|
'react-hooks/rules-of-hooks': 'error',
|
|
117
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
118
|
+
'react-hooks/config': 'error',
|
|
119
|
+
'react-hooks/error-boundaries': 'error',
|
|
120
|
+
'react-hooks/component-hook-factories': 'error',
|
|
121
|
+
'react-hooks/gating': 'error',
|
|
122
|
+
'react-hooks/globals': 'error',
|
|
123
|
+
'react-hooks/immutability': 'error',
|
|
124
|
+
'react-hooks/preserve-manual-memoization': 'error',
|
|
125
|
+
'react-hooks/purity': 'error',
|
|
126
|
+
'react-hooks/refs': 'error',
|
|
127
|
+
'react-hooks/set-state-in-effect': 'error',
|
|
128
|
+
'react-hooks/set-state-in-render': 'error',
|
|
129
|
+
'react-hooks/static-components': 'error',
|
|
130
|
+
'react-hooks/unsupported-syntax': 'warn',
|
|
131
|
+
'react-hooks/use-memo': 'error',
|
|
132
|
+
'react-hooks/incompatible-library': 'warn',
|
|
114
133
|
'jsx-a11y/alt-text': 'warn',
|
|
115
134
|
'jsx-a11y/anchor-has-content': 'error',
|
|
116
135
|
'jsx-a11y/anchor-is-valid': 'error',
|
|
@@ -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.
|
|
3
|
+
"version": "13.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "fullstacks <fullstacksjs@gmail.com>",
|
|
6
6
|
"description": "fullstacks eslint config",
|
|
@@ -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": "
|
|
54
|
+
"eslint-plugin-react-hooks": "7.0.0",
|
|
55
55
|
"eslint-plugin-regexp": "2.10.0",
|
|
56
56
|
"eslint-plugin-storybook": "0.12.0",
|
|
57
57
|
"globals": "16.4.0",
|
package/src/modules/react.mjs
CHANGED
|
@@ -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
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,
|
|
@@ -82,7 +86,9 @@ function react(options = {}) {
|
|
|
82
86
|
'@eslint-react/no-unstable-default-props': 'error',
|
|
83
87
|
'@eslint-react/no-unused-class-component-members': 'warn',
|
|
84
88
|
'@eslint-react/no-unused-state': 'warn',
|
|
85
|
-
|
|
89
|
+
...predicate(projectService, {
|
|
90
|
+
'@eslint-react/no-unused-props': 'warn',
|
|
91
|
+
}),
|
|
86
92
|
'@eslint-react/no-useless-forward-ref': 'off',
|
|
87
93
|
'@eslint-react/no-useless-fragment': 'warn',
|
|
88
94
|
'@eslint-react/no-use-context': 'warn',
|
|
@@ -107,8 +113,24 @@ function react(options = {}) {
|
|
|
107
113
|
'@eslint-react/web-api/no-leaked-interval': 'error',
|
|
108
114
|
'@eslint-react/web-api/no-leaked-resize-observer': 'error',
|
|
109
115
|
|
|
110
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
111
116
|
'react-hooks/rules-of-hooks': 'error',
|
|
117
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
118
|
+
|
|
119
|
+
'react-hooks/config': 'error',
|
|
120
|
+
'react-hooks/error-boundaries': 'error',
|
|
121
|
+
'react-hooks/component-hook-factories': 'error',
|
|
122
|
+
'react-hooks/gating': 'error',
|
|
123
|
+
'react-hooks/globals': 'error',
|
|
124
|
+
'react-hooks/immutability': 'error',
|
|
125
|
+
'react-hooks/preserve-manual-memoization': 'error',
|
|
126
|
+
'react-hooks/purity': 'error',
|
|
127
|
+
'react-hooks/refs': 'error',
|
|
128
|
+
'react-hooks/set-state-in-effect': 'error',
|
|
129
|
+
'react-hooks/set-state-in-render': 'error',
|
|
130
|
+
'react-hooks/static-components': 'error',
|
|
131
|
+
'react-hooks/unsupported-syntax': 'warn',
|
|
132
|
+
'react-hooks/use-memo': 'error',
|
|
133
|
+
'react-hooks/incompatible-library': 'warn',
|
|
112
134
|
|
|
113
135
|
'jsx-a11y/alt-text': 'warn',
|
|
114
136
|
'jsx-a11y/anchor-has-content': 'error',
|
|
@@ -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',
|