@jpp-toolkit/eslint-config 0.0.11
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/LICENSE.md +21 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.mjs +654 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +73 -0
- package/src/configs/eslint-config.ts +1305 -0
- package/src/configs/ignore-config.ts +17 -0
- package/src/configs/import-x-config.ts +344 -0
- package/src/configs/jsx-a11y-config.ts +278 -0
- package/src/configs/perfectionist-config.ts +180 -0
- package/src/configs/prettier-config.ts +11 -0
- package/src/configs/react-config.ts +706 -0
- package/src/configs/react-hooks-config.ts +11 -0
- package/src/configs/stylistic-config.ts +746 -0
- package/src/configs/typescript-config.ts +1211 -0
- package/src/configs/unicorn-config.ts +1212 -0
- package/src/configs/vitest-config.ts +536 -0
- package/src/index.ts +73 -0
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
import react from 'eslint-plugin-react';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* React configuration.
|
|
6
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react}
|
|
7
|
+
*/
|
|
8
|
+
export const reactConfig = defineConfig({
|
|
9
|
+
name: 'react-config',
|
|
10
|
+
extends: [react.configs.flat['recommended']!, react.configs.flat['jsx-runtime']!],
|
|
11
|
+
settings: {
|
|
12
|
+
react: {
|
|
13
|
+
version: 'detect',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
/**
|
|
18
|
+
* Enforces consistent naming for boolean props.
|
|
19
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md}
|
|
20
|
+
*/
|
|
21
|
+
'react/boolean-prop-naming': [
|
|
22
|
+
'error',
|
|
23
|
+
{ rule: '^(is|has|can|should)[A-Z][A-Za-z0-9]*', validateNested: true },
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Disallow usage of button elements without an explicit type attribute.
|
|
28
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md}
|
|
29
|
+
*/
|
|
30
|
+
'react/button-has-type': 'error',
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Enforce using onChange or readonly attribute when checked is used.
|
|
34
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md}
|
|
35
|
+
*/
|
|
36
|
+
'react/checked-requires-onchange-or-readonly': 'error',
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Enforce all defaultProps have a corresponding non-required PropType.
|
|
40
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md}
|
|
41
|
+
*/
|
|
42
|
+
'react/default-props-match-prop-types': 'error',
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Enforce consistent usage of destructuring assignment of props, state, and context.
|
|
46
|
+
* @fixable
|
|
47
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md}
|
|
48
|
+
*/
|
|
49
|
+
'react/destructuring-assignment': 'error',
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Disallow certain props on components.
|
|
53
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md}
|
|
54
|
+
*/
|
|
55
|
+
// 'react/forbid-component-props': 'error',
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Disallow certain props on DOM Nodes.
|
|
59
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md}
|
|
60
|
+
*/
|
|
61
|
+
// 'react/forbid-dom-props': 'error',
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Disallow certain elements.
|
|
65
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md}
|
|
66
|
+
*/
|
|
67
|
+
// 'react/forbid-elements': 'error',
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Disallow using another component's propTypes.
|
|
71
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md}
|
|
72
|
+
*/
|
|
73
|
+
// 'react/forbid-foreign-prop-types': 'error',
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Disallow certain propTypes.
|
|
77
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md}
|
|
78
|
+
*/
|
|
79
|
+
// 'react/forbid-prop-types': 'error',
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Require all forwardRef components include a ref parameter.
|
|
83
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forward-ref-uses-ref.md}
|
|
84
|
+
*/
|
|
85
|
+
'react/forward-ref-uses-ref': 'error',
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Enforce a specific function type for function components.
|
|
89
|
+
* @fixable
|
|
90
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md}
|
|
91
|
+
*/
|
|
92
|
+
'react/function-component-definition': [
|
|
93
|
+
'error',
|
|
94
|
+
{ namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' },
|
|
95
|
+
],
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Ensure destructuring and symmetric naming of useState hook value and setter variables.
|
|
99
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md}
|
|
100
|
+
*/
|
|
101
|
+
'react/hook-use-state': 'error',
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Enforce sandbox attribute on iframe elements.
|
|
105
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md}
|
|
106
|
+
*/
|
|
107
|
+
'react/iframe-missing-sandbox': 'error',
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Enforce boolean attributes notation in JSX.
|
|
111
|
+
* @fixable
|
|
112
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md}
|
|
113
|
+
*/
|
|
114
|
+
'react/jsx-boolean-value': ['error', 'never'],
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Enforce or disallow spaces inside of curly braces in JSX attributes and expressions.
|
|
118
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md}
|
|
119
|
+
*/
|
|
120
|
+
'react/jsx-child-element-spacing': 'error',
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Enforce closing bracket location in JSX.
|
|
124
|
+
* @fixable
|
|
125
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md}
|
|
126
|
+
*/
|
|
127
|
+
'react/jsx-closing-bracket-location': 'error',
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Enforce closing tag location for multiline JSX.
|
|
131
|
+
* @fixable
|
|
132
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md}
|
|
133
|
+
*/
|
|
134
|
+
'react/jsx-closing-tag-location': 'error',
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes.
|
|
138
|
+
* @fixable
|
|
139
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md}
|
|
140
|
+
*/
|
|
141
|
+
'react/jsx-curly-brace-presence': ['error', 'never'],
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Enforce consistent linebreaks in curly braces in JSX attributes and expressions.
|
|
145
|
+
* @fixable
|
|
146
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md}
|
|
147
|
+
*/
|
|
148
|
+
'react/jsx-curly-newline': 'error',
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Enforce or disallow spaces inside of curly braces in JSX attributes and expressions.
|
|
152
|
+
* @fixable
|
|
153
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md}
|
|
154
|
+
*/
|
|
155
|
+
'react/jsx-curly-spacing': 'error',
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Enforce or disallow spaces around equal signs in JSX attributes.
|
|
159
|
+
* @fixable
|
|
160
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md}
|
|
161
|
+
*/
|
|
162
|
+
'react/jsx-equals-spacing': 'error',
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Disallow file extensions that may contain JSX.
|
|
166
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md}
|
|
167
|
+
*/
|
|
168
|
+
// 'react/jsx-filename-extension': 'error',
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Enforce proper position of the first property in JSX.
|
|
172
|
+
* @fixable
|
|
173
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md}
|
|
174
|
+
*/
|
|
175
|
+
'react/jsx-first-prop-new-line': 'error',
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Enforce shorthand or standard form for React fragments.
|
|
179
|
+
* @fixable
|
|
180
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md}
|
|
181
|
+
*/
|
|
182
|
+
'react/jsx-fragments': 'error',
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Enforce event handler naming conventions in JSX.
|
|
186
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md}
|
|
187
|
+
*/
|
|
188
|
+
'react/jsx-handler-names': 'error',
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Enforce JSX indentation.
|
|
192
|
+
* @fixable
|
|
193
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md}
|
|
194
|
+
*/
|
|
195
|
+
'react/jsx-indent': 'error',
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Enforce props indentation in JSX.
|
|
199
|
+
* @fixable
|
|
200
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md}
|
|
201
|
+
*/
|
|
202
|
+
'react/jsx-indent-props': 'error',
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Enforce JSX maximum depth.
|
|
206
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md}
|
|
207
|
+
*/
|
|
208
|
+
// 'react/jsx-max-depth': 'error',
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Enforce maximum of props on a single line in JSX.
|
|
212
|
+
* @fixable
|
|
213
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md}
|
|
214
|
+
*/
|
|
215
|
+
// 'react/jsx-max-props-per-line': 'error',
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Require or prevent a new line after jsx elements and expressions.
|
|
219
|
+
* @fixable
|
|
220
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-newline.md}
|
|
221
|
+
*/
|
|
222
|
+
// 'react/jsx-newline': 'error',
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Disallow .bind() or arrow functions in JSX props.
|
|
226
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md}
|
|
227
|
+
*/
|
|
228
|
+
'react/jsx-no-bind': 'error',
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Disallows JSX context provider values from taking values that will cause needless rerenders.
|
|
232
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md}
|
|
233
|
+
*/
|
|
234
|
+
'react/jsx-no-constructed-context-values': 'error',
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Disallow problematic leaked values from being rendered.
|
|
238
|
+
* @fixable
|
|
239
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md}
|
|
240
|
+
*/
|
|
241
|
+
'react/jsx-no-leaked-render': 'error',
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Disallow usage of string literals in JSX.
|
|
245
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md}
|
|
246
|
+
*/
|
|
247
|
+
// 'react/jsx-no-literals': 'error',
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Disallow usage of javascript: URLs.
|
|
251
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md}
|
|
252
|
+
*/
|
|
253
|
+
'react/jsx-no-script-url': 'error',
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Disallow unnecessary fragments.
|
|
257
|
+
* @fixable
|
|
258
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md}
|
|
259
|
+
*/
|
|
260
|
+
'react/jsx-no-useless-fragment': 'error',
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Require one JSX element per line.
|
|
264
|
+
* @fixable
|
|
265
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md}
|
|
266
|
+
*/
|
|
267
|
+
'react/jsx-one-expression-per-line': 'error',
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Enforce PascalCase for user-defined JSX components.
|
|
271
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md}
|
|
272
|
+
*/
|
|
273
|
+
'react/jsx-pascal-case': 'error',
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Disallow multiple spaces between inline JSX props.
|
|
277
|
+
* @fixable
|
|
278
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md}
|
|
279
|
+
*/
|
|
280
|
+
'react/jsx-props-no-multi-spaces': 'error',
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Disallow JSX prop spreading the same identifier multiple times.
|
|
284
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spread-multi.md}
|
|
285
|
+
*/
|
|
286
|
+
'react/jsx-props-no-spread-multi': 'error',
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Disallow JSX prop spreading.
|
|
290
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md}
|
|
291
|
+
*/
|
|
292
|
+
// 'react/jsx-props-no-spreading': 'error',
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Enforce defaultProps declarations alphabetical sorting.
|
|
296
|
+
* @deprecated
|
|
297
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md}
|
|
298
|
+
*/
|
|
299
|
+
// 'react/jsx-sort-default-props': 'error',
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Enforce props alphabetical sorting.
|
|
303
|
+
* @fixable
|
|
304
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md}
|
|
305
|
+
*/
|
|
306
|
+
'react/jsx-sort-props': [
|
|
307
|
+
'error',
|
|
308
|
+
{
|
|
309
|
+
callbacksLast: true,
|
|
310
|
+
shorthandLast: true,
|
|
311
|
+
multiline: 'last',
|
|
312
|
+
ignoreCase: false,
|
|
313
|
+
noSortAlphabetically: false,
|
|
314
|
+
reservedFirst: true,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Enforce spacing before closing bracket in JSX.
|
|
320
|
+
* @fixable
|
|
321
|
+
* @deprecated
|
|
322
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md}
|
|
323
|
+
*/
|
|
324
|
+
// 'react/jsx-space-before-closing': 'error',
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Enforce whitespace in and around the JSX opening and closing brackets.
|
|
328
|
+
* @fixable
|
|
329
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md}
|
|
330
|
+
*/
|
|
331
|
+
'react/jsx-tag-spacing': 'error',
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Disallow missing parentheses around multiline JSX.
|
|
335
|
+
* @fixable
|
|
336
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md}
|
|
337
|
+
*/
|
|
338
|
+
'react/jsx-wrap-multilines': 'error',
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Disallow when this.state is accessed within setState.
|
|
342
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md}
|
|
343
|
+
*/
|
|
344
|
+
'react/no-access-state-in-setstate': 'error',
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Disallow adjacent inline elements not separated by whitespace.
|
|
348
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md}
|
|
349
|
+
*/
|
|
350
|
+
'react/no-adjacent-inline-elements': 'error',
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Disallow usage of Array index in keys.
|
|
354
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md}
|
|
355
|
+
*/
|
|
356
|
+
'react/no-array-index-key': 'error',
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Lifecycle methods should be methods on the prototype, not class fields.
|
|
360
|
+
* @fixable
|
|
361
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md}
|
|
362
|
+
*/
|
|
363
|
+
'react/no-arrow-function-lifecycle': 'error',
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Disallow usage of dangerous JSX properties.
|
|
367
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md}
|
|
368
|
+
*/
|
|
369
|
+
'react/no-danger': 'error',
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Disallow usage of setState in componentDidMount.
|
|
373
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md}
|
|
374
|
+
*/
|
|
375
|
+
'react/no-did-mount-set-state': 'error',
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Disallow usage of setState in componentDidUpdate.
|
|
379
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md}
|
|
380
|
+
*/
|
|
381
|
+
'react/no-did-update-set-state': 'error',
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Disallow usage of invalid attributes.
|
|
385
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md}
|
|
386
|
+
*/
|
|
387
|
+
'react/no-invalid-html-attribute': 'error',
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Disallow multiple component definition per file.
|
|
391
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md}
|
|
392
|
+
*/
|
|
393
|
+
// 'react/no-multi-comp': 'error',
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Enforce that namespaces are not used in React elements.
|
|
397
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-namespace.md}
|
|
398
|
+
*/
|
|
399
|
+
'react/no-namespace': 'error',
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Disallow usage of referential-type variables as default param in functional component.
|
|
403
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-object-type-as-default-prop.md}
|
|
404
|
+
*/
|
|
405
|
+
'react/no-object-type-as-default-prop': 'error',
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Disallow usage of shouldComponentUpdate when extending React.PureComponent.
|
|
409
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md}
|
|
410
|
+
*/
|
|
411
|
+
'react/no-redundant-should-component-update': 'error',
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Disallow usage of setState.
|
|
415
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-set-state.md}
|
|
416
|
+
*/
|
|
417
|
+
'react/no-set-state': 'error',
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Disallow this from being used in stateless functional components.
|
|
421
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md}
|
|
422
|
+
*/
|
|
423
|
+
'react/no-this-in-sfc': 'error',
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Disallow common typos.
|
|
427
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md}
|
|
428
|
+
*/
|
|
429
|
+
'react/no-typos': 'error',
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Disallow creating unstable components inside components.
|
|
433
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md}
|
|
434
|
+
*/
|
|
435
|
+
'react/no-unstable-nested-components': 'error',
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Disallow declaring unused methods of component class.
|
|
439
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md}
|
|
440
|
+
*/
|
|
441
|
+
'react/no-unused-class-component-methods': 'error',
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Disallow definitions of unused propTypes.
|
|
445
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md}
|
|
446
|
+
*/
|
|
447
|
+
'react/no-unused-prop-types': 'error',
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Disallow definitions of unused state.
|
|
451
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md}
|
|
452
|
+
*/
|
|
453
|
+
'react/no-unused-state': 'error',
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Disallow usage of setState in componentWillUpdate.
|
|
457
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md}
|
|
458
|
+
*/
|
|
459
|
+
'react/no-will-update-set-state': 'error',
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Enforce ES5 or ES6 class for React Components.
|
|
463
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md}
|
|
464
|
+
*/
|
|
465
|
+
'react/prefer-es6-class': 'error',
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Prefer exact proptype definitions.
|
|
469
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md}
|
|
470
|
+
*/
|
|
471
|
+
'react/prefer-exact-props': 'error',
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Enforce that props are read-only.
|
|
475
|
+
* @fixable
|
|
476
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md}
|
|
477
|
+
*/
|
|
478
|
+
'react/prefer-read-only-props': 'error',
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Enforce stateless components to be written as a pure function.
|
|
482
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md}
|
|
483
|
+
*/
|
|
484
|
+
'react/prefer-stateless-function': 'error',
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Enforce a defaultProps definition for every prop that is not a required prop.
|
|
488
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md}
|
|
489
|
+
*/
|
|
490
|
+
'react/require-default-props': 'error',
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Enforce React components to have a shouldComponentUpdate method.
|
|
494
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-optimization.md}
|
|
495
|
+
*/
|
|
496
|
+
'react/require-optimization': 'error',
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Disallow extra closing tags for components without children.
|
|
500
|
+
* @fixable
|
|
501
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md}
|
|
502
|
+
*/
|
|
503
|
+
'react/self-closing-comp': 'error',
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Enforce component methods order.
|
|
507
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-comp.md}
|
|
508
|
+
*/
|
|
509
|
+
'react/sort-comp': 'error',
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Enforce defaultProps declarations alphabetical sorting.
|
|
513
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-default-props.md}
|
|
514
|
+
*/
|
|
515
|
+
'react/sort-default-props': 'error',
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Enforce propTypes declarations alphabetical sorting.
|
|
519
|
+
* @fixable
|
|
520
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md}
|
|
521
|
+
*/
|
|
522
|
+
'react/sort-prop-types': 'error',
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Enforce class component state initialization style.
|
|
526
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md}
|
|
527
|
+
*/
|
|
528
|
+
'react/state-in-constructor': 'error',
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Enforces where React component static properties should be positioned.
|
|
532
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md}
|
|
533
|
+
*/
|
|
534
|
+
'react/static-property-placement': 'error',
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Enforce style prop value is an object.
|
|
538
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md}
|
|
539
|
+
*/
|
|
540
|
+
// 'react/style-prop-object': 'error',
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Disallow void DOM elements (e.g. <img />, <br />) from receiving children.
|
|
544
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md}
|
|
545
|
+
*/
|
|
546
|
+
'react/void-dom-elements-no-children': 'error',
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Disallow missing displayName in a React component definition.
|
|
550
|
+
* @config recommended
|
|
551
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md}
|
|
552
|
+
*/
|
|
553
|
+
// 'react/display-name': 'off',
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Disallow missing key props in iterators/collection literals.
|
|
557
|
+
* @config recommended
|
|
558
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md}
|
|
559
|
+
*/
|
|
560
|
+
// 'react/jsx-key': 'off',
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Disallow comments from being inserted as text nodes.
|
|
564
|
+
* @config recommended
|
|
565
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md}
|
|
566
|
+
*/
|
|
567
|
+
// 'react/jsx-no-comment-textnodes': 'off',
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Disallow duplicate properties in JSX.
|
|
571
|
+
* @config recommended
|
|
572
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md}
|
|
573
|
+
*/
|
|
574
|
+
// 'react/jsx-no-duplicate-props': 'off',
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Disallow target="_blank" attribute without rel="noreferrer".
|
|
578
|
+
* @config recommended
|
|
579
|
+
* @fixable
|
|
580
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md}
|
|
581
|
+
*/
|
|
582
|
+
// 'react/jsx-no-target-blank': 'off',
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Disallow undeclared variables in JSX.
|
|
586
|
+
* @config recommended
|
|
587
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md}
|
|
588
|
+
*/
|
|
589
|
+
// 'react/jsx-no-undef': 'off',
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Disallow React to be incorrectly marked as unused.
|
|
593
|
+
* @config recommended
|
|
594
|
+
* @config jsx-runtime
|
|
595
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md}
|
|
596
|
+
*/
|
|
597
|
+
// 'react/jsx-uses-react': 'off',
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Disallow variables used in JSX to be incorrectly marked as unused.
|
|
601
|
+
* @config recommended
|
|
602
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md}
|
|
603
|
+
*/
|
|
604
|
+
// 'react/jsx-uses-vars': 'off',
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Disallow passing of children as props.
|
|
608
|
+
* @config recommended
|
|
609
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md}
|
|
610
|
+
*/
|
|
611
|
+
// 'react/no-children-prop': 'off',
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Disallow when a DOM element is using both children and dangerouslySetInnerHTML.
|
|
615
|
+
* @config recommended
|
|
616
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md}
|
|
617
|
+
*/
|
|
618
|
+
// 'react/no-danger-with-children': 'off',
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Disallow usage of deprecated methods.
|
|
622
|
+
* @config recommended
|
|
623
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md}
|
|
624
|
+
*/
|
|
625
|
+
// 'react/no-deprecated': 'off',
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Disallow direct mutation of this.state.
|
|
629
|
+
* @config recommended
|
|
630
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md}
|
|
631
|
+
*/
|
|
632
|
+
// 'react/no-direct-mutation-state': 'off',
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Disallow usage of findDOMNode.
|
|
636
|
+
* @config recommended
|
|
637
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md}
|
|
638
|
+
*/
|
|
639
|
+
// 'react/no-find-dom-node': 'off',
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Disallow usage of isMounted.
|
|
643
|
+
* @config recommended
|
|
644
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md}
|
|
645
|
+
*/
|
|
646
|
+
// 'react/no-is-mounted': 'off',
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Disallow usage of the return value of ReactDOM.render.
|
|
650
|
+
* @config recommended
|
|
651
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md}
|
|
652
|
+
*/
|
|
653
|
+
// 'react/no-render-return-value': 'off',
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Disallow using string references.
|
|
657
|
+
* @config recommended
|
|
658
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md}
|
|
659
|
+
*/
|
|
660
|
+
// 'react/no-string-refs': 'off',
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Disallow unescaped HTML entities from appearing in markup.
|
|
664
|
+
* @config recommended
|
|
665
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md}
|
|
666
|
+
*/
|
|
667
|
+
// 'react/no-unescaped-entities': 'off',
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Disallow usage of unknown DOM property.
|
|
671
|
+
* @config recommended
|
|
672
|
+
* @fixable
|
|
673
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md}
|
|
674
|
+
*/
|
|
675
|
+
// 'react/no-unknown-property': 'off',
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Disallow usage of unsafe lifecycle methods.
|
|
679
|
+
* @config recommended
|
|
680
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md}
|
|
681
|
+
*/
|
|
682
|
+
// 'react/no-unsafe': 'off',
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Disallow missing props validation in a React component definition.
|
|
686
|
+
* @config recommended
|
|
687
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md}
|
|
688
|
+
*/
|
|
689
|
+
// 'react/prop-types': 'off',
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Disallow missing React when using JSX.
|
|
693
|
+
* @config recommended
|
|
694
|
+
* @config jsx-runtime
|
|
695
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md}
|
|
696
|
+
*/
|
|
697
|
+
// 'react/react-in-jsx-scope': 'off',
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Enforce ES5 or ES6 class for returning value in render function.
|
|
701
|
+
* @config recommended
|
|
702
|
+
* @see {@link https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md}
|
|
703
|
+
*/
|
|
704
|
+
// 'react/require-render-return': 'off',
|
|
705
|
+
},
|
|
706
|
+
});
|