@innovixx/eslint-config 3.0.13 → 4.0.0-alpha.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 +370 -20
- package/config/configs/base/index.mjs +40 -40
- package/config/configs/base/rules/best-practices.mjs +331 -333
- package/config/configs/base/rules/errors.mjs +115 -115
- package/config/configs/base/rules/es6.mjs +176 -176
- package/config/configs/base/rules/imports.mjs +238 -238
- package/config/configs/base/rules/variables.mjs +31 -31
- package/config/configs/jest/index.mjs +19 -19
- package/config/configs/jest/rules/jest-dom.mjs +8 -8
- package/config/configs/jest/rules/jest.mjs +33 -33
- package/config/configs/react/index.mjs +31 -42
- package/config/configs/react/rules/custom-rules.mjs +332 -0
- package/config/configs/react/rules/react-a11y.mjs +227 -227
- package/config/configs/react/rules/react-hooks.mjs +6 -6
- package/config/configs/react/rules/react.mjs +49 -452
- package/config/configs/typescript/index.mjs +24 -24
- package/config/configs/typescript/rules/all.mjs +14 -14
- package/config/configs/typescript/settings/typescript.mjs +8 -11
- package/config/deepMerge.mjs +47 -47
- package/config/index.mjs +117 -117
- package/demo/components/ComponentTest/index.tsx +1 -1
- package/demo/components/ComponentTestWithProps/index.tsx +2 -2
- package/package.json +19 -20
- package/tsconfig.json +1 -1
|
@@ -1,279 +1,33 @@
|
|
|
1
1
|
/** @type {import('eslint').Linter.Config} */
|
|
2
|
-
|
|
3
2
|
const reactRules = {
|
|
4
3
|
rules: {
|
|
5
|
-
|
|
6
|
-
// https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules
|
|
7
|
-
|
|
8
|
-
// Specify whether double or single quotes should be used in JSX attributes
|
|
9
|
-
// https://eslint.org/docs/rules/jsx-quotes
|
|
10
|
-
'jsx-quotes': ['error', 'prefer-double'],
|
|
4
|
+
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
|
|
11
5
|
|
|
12
|
-
'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'getDefaultProps',
|
|
17
|
-
'getChildContext',
|
|
18
|
-
'componentWillMount',
|
|
19
|
-
'UNSAFE_componentWillMount',
|
|
20
|
-
'componentDidMount',
|
|
21
|
-
'componentWillReceiveProps',
|
|
22
|
-
'UNSAFE_componentWillReceiveProps',
|
|
23
|
-
'shouldComponentUpdate',
|
|
24
|
-
'componentWillUpdate',
|
|
25
|
-
'UNSAFE_componentWillUpdate',
|
|
26
|
-
'componentDidUpdate',
|
|
27
|
-
'componentWillUnmount',
|
|
28
|
-
'componentDidCatch',
|
|
29
|
-
'getSnapshotBeforeUpdate',
|
|
30
|
-
],
|
|
31
|
-
}],
|
|
6
|
+
'@stylistic/jsx-closing-bracket-location': [
|
|
7
|
+
'error',
|
|
8
|
+
'line-aligned',
|
|
9
|
+
],
|
|
32
10
|
|
|
33
|
-
|
|
34
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
35
|
-
'react/display-name': ['off', { ignoreTranspilerName: false }],
|
|
11
|
+
'@stylistic/jsx-closing-tag-location': 'error',
|
|
36
12
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'react/forbid-prop-types': ['error', {
|
|
40
|
-
forbid: ['any', 'array', 'object'],
|
|
41
|
-
checkContextTypes: true,
|
|
42
|
-
checkChildContextTypes: true,
|
|
13
|
+
'@stylistic/jsx-curly-spacing': ['error', 'never', {
|
|
14
|
+
allowMultiline: true,
|
|
43
15
|
}],
|
|
44
16
|
|
|
45
|
-
|
|
46
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/forbid-dom-props.md
|
|
47
|
-
'react/forbid-dom-props': ['off', { forbid: [] }],
|
|
48
|
-
|
|
49
|
-
// Enforce boolean attributes notation in JSX
|
|
50
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
51
|
-
'react/jsx-boolean-value': ['error', 'never', { always: [] }],
|
|
52
|
-
|
|
53
|
-
// Validate closing bracket location in JSX
|
|
54
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
|
|
55
|
-
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
|
17
|
+
'@stylistic/jsx-indent-props': ['error', 'tab'],
|
|
56
18
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'react/jsx-closing-tag-location': 'error',
|
|
60
|
-
|
|
61
|
-
// Enforce or disallow spaces inside of curly braces in JSX attributes
|
|
62
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
|
63
|
-
'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
|
|
64
|
-
|
|
65
|
-
// Enforce event handler naming conventions in JSX
|
|
66
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
67
|
-
'react/jsx-handler-names': ['off', {
|
|
68
|
-
eventHandlerPrefix: 'handle',
|
|
69
|
-
eventHandlerPropPrefix: 'on',
|
|
19
|
+
'@stylistic/jsx-max-props-per-line': ['error', {
|
|
20
|
+
maximum: 1,
|
|
70
21
|
}],
|
|
71
22
|
|
|
72
|
-
|
|
73
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
|
|
74
|
-
'react/jsx-indent-props': ['error', 'tab'],
|
|
75
|
-
|
|
76
|
-
// Validate JSX has key prop when in array or iterator
|
|
77
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
78
|
-
'react/jsx-key': 'off',
|
|
79
|
-
|
|
80
|
-
// Limit maximum of props on a single line in JSX
|
|
81
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
|
|
82
|
-
'react/jsx-max-props-per-line': ['error', { maximum: 1 }],
|
|
83
|
-
|
|
84
|
-
// Prevent usage of .bind() in JSX props
|
|
85
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
|
86
|
-
'react/jsx-no-bind': ['error', {
|
|
87
|
-
ignoreRefs: true,
|
|
88
|
-
allowArrowFunctions: true,
|
|
89
|
-
allowFunctions: false,
|
|
90
|
-
allowBind: false,
|
|
91
|
-
ignoreDOMComponents: true,
|
|
92
|
-
}],
|
|
93
|
-
|
|
94
|
-
// Prevent duplicate props in JSX
|
|
95
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
|
|
96
|
-
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
|
|
97
|
-
|
|
98
|
-
// Prevent usage of unwrapped JSX strings
|
|
99
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
100
|
-
'react/jsx-no-literals': ['off', { noStrings: true }],
|
|
101
|
-
|
|
102
|
-
// Disallow undeclared variables in JSX
|
|
103
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
104
|
-
'react/jsx-no-undef': 'error',
|
|
105
|
-
|
|
106
|
-
// Enforce PascalCase for user-defined JSX components
|
|
107
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
108
|
-
'react/jsx-pascal-case': ['error', {
|
|
23
|
+
'@stylistic/jsx-pascal-case': ['error', {
|
|
109
24
|
allowAllCaps: true,
|
|
110
25
|
ignore: [],
|
|
111
26
|
}],
|
|
112
27
|
|
|
113
|
-
|
|
114
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
|
115
|
-
'react/sort-prop-types': ['off', {
|
|
116
|
-
ignoreCase: true,
|
|
117
|
-
callbacksLast: false,
|
|
118
|
-
requiredFirst: false,
|
|
119
|
-
sortShapeProp: true,
|
|
120
|
-
}],
|
|
121
|
-
|
|
122
|
-
// Deprecated in favor of react/jsx-sort-props
|
|
123
|
-
'react/jsx-sort-prop-types': 'off',
|
|
124
|
-
|
|
125
|
-
// Enforce props alphabetical sorting
|
|
126
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
127
|
-
'react/jsx-sort-props': ['off', {
|
|
128
|
-
ignoreCase: true,
|
|
129
|
-
callbacksLast: false,
|
|
130
|
-
shorthandFirst: false,
|
|
131
|
-
shorthandLast: false,
|
|
132
|
-
noSortAlphabetically: false,
|
|
133
|
-
reservedFirst: true,
|
|
134
|
-
}],
|
|
135
|
-
|
|
136
|
-
// Enforce defaultProps declarations alphabetical sorting
|
|
137
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-sort-default-props.md
|
|
138
|
-
'react/jsx-sort-default-props': ['off', {
|
|
139
|
-
ignoreCase: true,
|
|
140
|
-
}],
|
|
141
|
-
|
|
142
|
-
// Prevent React to be incorrectly marked as unused
|
|
143
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
|
|
144
|
-
'react/jsx-uses-react': ['error'],
|
|
145
|
-
|
|
146
|
-
// Prevent variables used in JSX to be incorrectly marked as unused
|
|
147
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
|
|
148
|
-
'react/jsx-uses-vars': 'error',
|
|
149
|
-
|
|
150
|
-
// Prevent usage of dangerous JSX properties
|
|
151
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
152
|
-
'react/no-danger': 'off',
|
|
153
|
-
|
|
154
|
-
// Prevent usage of deprecated methods
|
|
155
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
|
156
|
-
'react/no-deprecated': ['error'],
|
|
157
|
-
|
|
158
|
-
// Prevent usage of setState in componentDidMount
|
|
159
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
|
160
|
-
// this is necessary for server-rendering
|
|
161
|
-
'react/no-did-mount-set-state': 'off',
|
|
162
|
-
|
|
163
|
-
// Prevent usage of setState in componentDidUpdate
|
|
164
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
165
|
-
'react/no-did-update-set-state': 'off',
|
|
166
|
-
|
|
167
|
-
// Prevent usage of setState in componentWillUpdate
|
|
168
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
169
|
-
'react/no-will-update-set-state': 'error',
|
|
170
|
-
|
|
171
|
-
// Prevent direct mutation of this.state
|
|
172
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
173
|
-
'react/no-direct-mutation-state': 'off',
|
|
174
|
-
|
|
175
|
-
// Prevent usage of isMounted
|
|
176
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
177
|
-
'react/no-is-mounted': 'error',
|
|
178
|
-
|
|
179
|
-
// Prevent multiple component definition per file
|
|
180
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
|
|
181
|
-
'react/no-multi-comp': 'off',
|
|
182
|
-
|
|
183
|
-
// Prevent usage of setState
|
|
184
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
|
|
185
|
-
'react/no-set-state': 'off',
|
|
186
|
-
|
|
187
|
-
// Prevent using string references
|
|
188
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
189
|
-
'react/no-string-refs': 'error',
|
|
190
|
-
|
|
191
|
-
// Prevent usage of unknown DOM property
|
|
192
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
|
|
193
|
-
'react/no-unknown-property': 'error',
|
|
194
|
-
|
|
195
|
-
// Require ES6 class declarations over React.createClass
|
|
196
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
197
|
-
'react/prefer-es6-class': ['error', 'always'],
|
|
198
|
-
|
|
199
|
-
// Require stateless functions when not using lifecycle methods, setState or ref
|
|
200
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
201
|
-
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
|
|
202
|
-
|
|
203
|
-
// Prevent missing props validation in a React component definition
|
|
204
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
|
|
205
|
-
'react/prop-types': ['error', {
|
|
206
|
-
ignore: [],
|
|
207
|
-
customValidators: [],
|
|
208
|
-
skipUndeclared: false,
|
|
209
|
-
}],
|
|
210
|
-
|
|
211
|
-
// Prevent missing React when using JSX
|
|
212
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
|
213
|
-
'react/react-in-jsx-scope': 'error',
|
|
28
|
+
'@stylistic/jsx-self-closing-comp': 'error',
|
|
214
29
|
|
|
215
|
-
|
|
216
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
217
|
-
'react/require-render-return': 'error',
|
|
218
|
-
|
|
219
|
-
// Prevent extra closing tags for components without children
|
|
220
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
221
|
-
'react/self-closing-comp': 'error',
|
|
222
|
-
|
|
223
|
-
// Enforce component methods order
|
|
224
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
|
|
225
|
-
'react/sort-comp': ['error', {
|
|
226
|
-
order: [
|
|
227
|
-
'static-variables',
|
|
228
|
-
'static-methods',
|
|
229
|
-
'instance-variables',
|
|
230
|
-
'lifecycle',
|
|
231
|
-
'/^on.+$/',
|
|
232
|
-
'getters',
|
|
233
|
-
'setters',
|
|
234
|
-
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
|
|
235
|
-
'instance-methods',
|
|
236
|
-
'everything-else',
|
|
237
|
-
'rendering',
|
|
238
|
-
],
|
|
239
|
-
groups: {
|
|
240
|
-
lifecycle: [
|
|
241
|
-
'displayName',
|
|
242
|
-
'propTypes',
|
|
243
|
-
'contextTypes',
|
|
244
|
-
'childContextTypes',
|
|
245
|
-
'mixins',
|
|
246
|
-
'statics',
|
|
247
|
-
'defaultProps',
|
|
248
|
-
'constructor',
|
|
249
|
-
'getDefaultProps',
|
|
250
|
-
'getInitialState',
|
|
251
|
-
'state',
|
|
252
|
-
'getChildContext',
|
|
253
|
-
'getDerivedStateFromProps',
|
|
254
|
-
'componentWillMount',
|
|
255
|
-
'UNSAFE_componentWillMount',
|
|
256
|
-
'componentDidMount',
|
|
257
|
-
'componentWillReceiveProps',
|
|
258
|
-
'UNSAFE_componentWillReceiveProps',
|
|
259
|
-
'shouldComponentUpdate',
|
|
260
|
-
'componentWillUpdate',
|
|
261
|
-
'UNSAFE_componentWillUpdate',
|
|
262
|
-
'getSnapshotBeforeUpdate',
|
|
263
|
-
'componentDidUpdate',
|
|
264
|
-
'componentDidCatch',
|
|
265
|
-
'componentWillUnmount',
|
|
266
|
-
],
|
|
267
|
-
rendering: [
|
|
268
|
-
'/^render.+$/',
|
|
269
|
-
'render',
|
|
270
|
-
],
|
|
271
|
-
},
|
|
272
|
-
}],
|
|
273
|
-
|
|
274
|
-
// Prevent missing parentheses around multilines JSX
|
|
275
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-wrap-multilines.md
|
|
276
|
-
'react/jsx-wrap-multilines': ['error', {
|
|
30
|
+
'@stylistic/jsx-wrap-multilines': ['error', {
|
|
277
31
|
declaration: 'parens-new-line',
|
|
278
32
|
assignment: 'parens-new-line',
|
|
279
33
|
return: 'parens-new-line',
|
|
@@ -283,221 +37,64 @@ const reactRules = {
|
|
|
283
37
|
prop: 'parens-new-line',
|
|
284
38
|
}],
|
|
285
39
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
// Enforce spacing around jsx equals signs
|
|
291
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
|
|
292
|
-
'react/jsx-equals-spacing': ['error', 'never'],
|
|
293
|
-
|
|
294
|
-
// Enforce JSX indentation
|
|
295
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
|
|
296
|
-
'react/jsx-indent': ['error', 'tab', {
|
|
297
|
-
checkAttributes: true,
|
|
298
|
-
indentLogicalExpressions: true,
|
|
299
|
-
}],
|
|
300
|
-
|
|
301
|
-
// Disallow target="_blank" on links
|
|
302
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-no-target-blank.md
|
|
303
|
-
'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
|
|
304
|
-
|
|
305
|
-
// only .jsx files may have JSX
|
|
306
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
307
|
-
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
|
|
308
|
-
|
|
309
|
-
// prevent accidental JS comments from being injected into JSX as text
|
|
310
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
311
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
312
|
-
|
|
313
|
-
// disallow using React.render/ReactDOM.render's return value
|
|
314
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
315
|
-
'react/no-render-return-value': 'error',
|
|
316
|
-
|
|
317
|
-
// require a shouldComponentUpdate method, or PureRenderMixin
|
|
318
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
|
|
319
|
-
'react/require-optimization': ['off', { allowDecorators: [] }],
|
|
320
|
-
|
|
321
|
-
// warn against using findDOMNode()
|
|
322
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
323
|
-
'react/no-find-dom-node': 'error',
|
|
324
|
-
|
|
325
|
-
// Forbid certain props on Components
|
|
326
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
|
|
327
|
-
'react/forbid-component-props': ['off', { forbid: [] }],
|
|
328
|
-
|
|
329
|
-
// Forbid certain elements
|
|
330
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
|
|
331
|
-
'react/forbid-elements': ['off', { forbid: [] }],
|
|
332
|
-
|
|
333
|
-
// Prevent problem with children and props.dangerouslySetInnerHTML
|
|
334
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
335
|
-
'react/no-danger-with-children': 'error',
|
|
336
|
-
|
|
337
|
-
// Prevent unused propType definitions
|
|
338
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
|
|
339
|
-
'react/no-unused-prop-types': ['error', {
|
|
340
|
-
customValidators: [
|
|
341
|
-
],
|
|
342
|
-
skipShapeProps: true,
|
|
343
|
-
}],
|
|
344
|
-
|
|
345
|
-
// Require style prop value be an object or var
|
|
346
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
347
|
-
'react/style-prop-object': 'error',
|
|
40
|
+
'@stylistic/jsx-first-prop-new-line': [
|
|
41
|
+
'error',
|
|
42
|
+
'multiline-multiprop',
|
|
43
|
+
],
|
|
348
44
|
|
|
349
|
-
|
|
350
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
|
|
351
|
-
'react/no-unescaped-entities': 'error',
|
|
45
|
+
'@stylistic/jsx-equals-spacing': ['error', 'never'],
|
|
352
46
|
|
|
353
|
-
|
|
354
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
|
355
|
-
'react/no-children-prop': 'error',
|
|
47
|
+
'@stylistic/indent': ['error', 'tab'],
|
|
356
48
|
|
|
357
|
-
|
|
358
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
|
|
359
|
-
'react/jsx-tag-spacing': ['error', {
|
|
49
|
+
'@stylistic/jsx-tag-spacing': ['error', {
|
|
360
50
|
closingSlash: 'never',
|
|
361
51
|
beforeSelfClosing: 'always',
|
|
362
52
|
afterOpening: 'never',
|
|
363
53
|
beforeClosing: 'never',
|
|
364
54
|
}],
|
|
365
55
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
'react/jsx-space-before-closing': ['off', 'always'],
|
|
370
|
-
|
|
371
|
-
// Prevent usage of Array index in keys
|
|
372
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
373
|
-
'react/no-array-index-key': 'off',
|
|
374
|
-
|
|
375
|
-
// Enforce a defaultProps definition for every prop that is not a required prop
|
|
376
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/require-default-props.md
|
|
377
|
-
'react/require-default-props': 'off',
|
|
378
|
-
|
|
379
|
-
// Forbids using non-exported propTypes
|
|
380
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
|
|
381
|
-
// this is intentionally set to "warn". it would be "error",
|
|
382
|
-
// but it's only critical if you're stripping propTypes in production.
|
|
383
|
-
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
|
|
384
|
-
|
|
385
|
-
// Prevent void DOM elements from receiving children
|
|
386
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
387
|
-
'react/void-dom-elements-no-children': 'error',
|
|
388
|
-
|
|
389
|
-
// Enforce all defaultProps have a corresponding non-required PropType
|
|
390
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/default-props-match-prop-types.md
|
|
391
|
-
'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
|
|
392
|
-
|
|
393
|
-
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
|
|
394
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/9e13ae2c51e44872b45cc15bf1ac3a72105bdd0e/docs/rules/no-redundant-should-component-update.md
|
|
395
|
-
'react/no-redundant-should-component-update': 'error',
|
|
396
|
-
|
|
397
|
-
// Prevent unused state values
|
|
398
|
-
// https://github.com/yannickcr/eslint-plugin-react/pull/1103/
|
|
399
|
-
'react/no-unused-state': 'error',
|
|
400
|
-
|
|
401
|
-
// Enforces consistent naming for boolean props
|
|
402
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/boolean-prop-naming.md
|
|
403
|
-
'react/boolean-prop-naming': ['off', {
|
|
404
|
-
propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
|
|
405
|
-
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
|
|
406
|
-
message: '',
|
|
56
|
+
'@stylistic/jsx-curly-brace-presence': ['error', {
|
|
57
|
+
props: 'never',
|
|
58
|
+
children: 'never',
|
|
407
59
|
}],
|
|
408
60
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
'react/no-typos': 'error',
|
|
412
|
-
|
|
413
|
-
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
|
|
414
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
415
|
-
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
|
|
416
|
-
|
|
417
|
-
// One JSX Element Per Line
|
|
418
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-one-expression-per-line.md
|
|
419
|
-
'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
|
|
420
|
-
|
|
421
|
-
// Enforce consistent usage of destructuring assignment of props, state, and context
|
|
422
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/destructuring-assignment.md
|
|
423
|
-
'react/destructuring-assignment': ['error', 'always'],
|
|
424
|
-
|
|
425
|
-
// Prevent using this.state within a this.setState
|
|
426
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-access-state-in-setstate.md
|
|
427
|
-
'react/no-access-state-in-setstate': 'error',
|
|
428
|
-
|
|
429
|
-
// Prevent usage of button elements without an explicit type attribute
|
|
430
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/button-has-type.md
|
|
431
|
-
'react/button-has-type': ['error', {
|
|
432
|
-
button: true,
|
|
433
|
-
submit: true,
|
|
434
|
-
reset: false,
|
|
61
|
+
'@stylistic/jsx-one-expression-per-line': ['error', {
|
|
62
|
+
allow: 'single-child',
|
|
435
63
|
}],
|
|
436
64
|
|
|
437
|
-
|
|
438
|
-
'react/jsx-child-element-spacing': 'off',
|
|
439
|
-
|
|
440
|
-
// Prevent this from being used in stateless functional components
|
|
441
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/no-this-in-sfc.md
|
|
442
|
-
'react/no-this-in-sfc': 'error',
|
|
443
|
-
|
|
444
|
-
// Validate JSX maximum depth
|
|
445
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/abe8381c0d6748047224c430ce47f02e40160ed0/docs/rules/jsx-max-depth.md
|
|
446
|
-
'react/jsx-max-depth': 'off',
|
|
447
|
-
|
|
448
|
-
// Disallow multiple spaces between inline JSX props
|
|
449
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/ac102885765be5ff37847a871f239c6703e1c7cc/docs/rules/jsx-props-no-multi-spaces.md
|
|
450
|
-
'react/jsx-props-no-multi-spaces': 'error',
|
|
65
|
+
'no-multi-spaces': 'off',
|
|
451
66
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
// Enforce shorthand or standard form for React fragments
|
|
457
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/bc976b837abeab1dffd90ac6168b746a83fc83cc/docs/rules/jsx-fragments.md
|
|
458
|
-
'react/jsx-fragments': ['error', 'element'],
|
|
67
|
+
'@stylistic/no-multi-spaces': ['error', {
|
|
68
|
+
ignoreEOLComments: false,
|
|
69
|
+
}],
|
|
459
70
|
|
|
460
|
-
|
|
461
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
462
|
-
'react/jsx-curly-newline': ['error', {
|
|
71
|
+
'@stylistic/jsx-curly-newline': ['error', {
|
|
463
72
|
multiline: 'consistent',
|
|
464
73
|
singleline: 'consistent',
|
|
465
74
|
}],
|
|
466
75
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
'react/state-in-constructor': ['error', 'always'],
|
|
76
|
+
'@eslint-react/no-component-will-mount': 'error',
|
|
77
|
+
'@eslint-react/no-component-will-receive-props': 'error',
|
|
78
|
+
'@eslint-react/no-component-will-update': 'error',
|
|
471
79
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
'react/
|
|
80
|
+
'@eslint-react/dom-no-render': 'error',
|
|
81
|
+
'@eslint-react/dom-no-hydrate': 'error',
|
|
82
|
+
'@eslint-react/dom-no-render-return-value': 'error',
|
|
83
|
+
'@eslint-react/dom-no-find-dom-node': 'error',
|
|
476
84
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
'react/
|
|
85
|
+
'@eslint-react/dom-no-unknown-property': 'error',
|
|
86
|
+
'@eslint-react/dom-no-unsafe-target-blank': 'error',
|
|
87
|
+
'@eslint-react/dom-no-string-style-prop': 'error',
|
|
88
|
+
'@eslint-react/dom-no-void-elements-with-children': 'error',
|
|
89
|
+
'@eslint-react/dom-no-missing-button-type': 'error',
|
|
480
90
|
|
|
481
|
-
|
|
482
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
|
|
483
|
-
'react/prefer-read-only-props': 'off',
|
|
484
|
-
},
|
|
91
|
+
'@eslint-react/dom-no-dangerously-set-innerhtml-with-children': 'error',
|
|
485
92
|
|
|
486
|
-
|
|
487
|
-
'
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
},
|
|
492
|
-
react: {
|
|
493
|
-
pragma: 'React',
|
|
494
|
-
version: 'detect',
|
|
495
|
-
},
|
|
496
|
-
propWrapperFunctions: [
|
|
497
|
-
'forbidExtraProps', // https://www.npmjs.com/package/airbnb-prop-types
|
|
498
|
-
'exact', // https://www.npmjs.com/package/prop-types-exact
|
|
499
|
-
'Object.freeze', // https://tc39.github.io/ecma262/#sec-object.freeze
|
|
500
|
-
],
|
|
93
|
+
'@eslint-react/jsx-no-comment-textnodes': 'error',
|
|
94
|
+
'@eslint-react/jsx-no-children-prop': 'error',
|
|
95
|
+
|
|
96
|
+
'@eslint-react/no-set-state-in-component-will-update': 'error',
|
|
97
|
+
'@eslint-react/no-access-state-in-setstate': 'error',
|
|
501
98
|
},
|
|
502
99
|
};
|
|
503
100
|
|
|
@@ -7,30 +7,30 @@ import { deepMerge } from '../../deepMerge.mjs';
|
|
|
7
7
|
/** @type {import('eslint').Linter.Config} */
|
|
8
8
|
|
|
9
9
|
export const index = deepMerge(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
10
|
+
{
|
|
11
|
+
settings: typeScriptSettings.settings,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
rules: allRules.rules,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
plugins: {
|
|
18
|
+
'@typescript-eslint': tsPlugin,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
languageOptions: {
|
|
23
|
+
parser: tsParser,
|
|
24
|
+
parserOptions: {
|
|
25
|
+
ecmaVersion: 2020,
|
|
26
|
+
project: './tsconfig.json',
|
|
27
|
+
sourceType: 'module',
|
|
28
|
+
ecmaFeatures: {
|
|
29
|
+
jsx: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
export default index;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/** @type {import('eslint').Linter.Config} */
|
|
2
2
|
|
|
3
3
|
const variableRules = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
rules: {
|
|
5
|
+
'@typescript-eslint/explicit-function-return-type': 'warn',
|
|
6
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
7
|
+
'@typescript-eslint/no-unused-vars': [
|
|
8
|
+
'warn',
|
|
9
|
+
{
|
|
10
|
+
vars: 'all',
|
|
11
|
+
args: 'after-used',
|
|
12
|
+
ignoreRestSiblings: true,
|
|
13
|
+
argsIgnorePattern: '^_',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
'@typescript-eslint/consistent-type-imports': 'warn',
|
|
17
|
+
},
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export default variableRules;
|