@prowise/eslint-config-linting-rules 2.4.7 → 3.0.1

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