@pplancq/eslint-config 5.0.8 → 5.0.10
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/CHANGELOG.md +17 -0
- package/README.md +4 -1
- package/package.json +9 -8
- package/rules/base.js +104 -104
- package/rules/prettier.js +2 -1
- package/rules/react-jsx-a11y.js +25 -25
- package/rules/react.js +59 -60
- package/rules/typescript.js +35 -35
- package/rules/vitest.js +27 -27
package/rules/prettier.js
CHANGED
|
@@ -5,7 +5,8 @@ const prettierRules = {
|
|
|
5
5
|
prettier: prettierPlugin,
|
|
6
6
|
},
|
|
7
7
|
rules: {
|
|
8
|
-
// eslint-plugin-prettier
|
|
8
|
+
// eslint-plugin-prettier
|
|
9
|
+
// https://github.com/prettier/eslint-plugin-prettier
|
|
9
10
|
'prettier/prettier': 'error',
|
|
10
11
|
|
|
11
12
|
// eslint
|
package/rules/react-jsx-a11y.js
CHANGED
|
@@ -25,7 +25,7 @@ const reactJsxA11yRules = {
|
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
27
|
|
|
28
|
-
// Enforce
|
|
28
|
+
// Enforce `<a>` text to not exactly match "click here", "here", "link", or "a link".
|
|
29
29
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-ambiguous-text.md
|
|
30
30
|
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
31
31
|
|
|
@@ -40,11 +40,11 @@ const reactJsxA11yRules = {
|
|
|
40
40
|
{ components: ['Link'], specialLink: ['to'], aspects: ['noHref', 'invalidHref', 'preferButton'] },
|
|
41
41
|
],
|
|
42
42
|
|
|
43
|
-
// Enforce elements with aria-activedescendant are tabbable.
|
|
43
|
+
// Enforce elements with `aria-activedescendant` are tabbable.
|
|
44
44
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-activedescendant-has-tabindex.md
|
|
45
45
|
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
46
46
|
|
|
47
|
-
// Enforce all aria
|
|
47
|
+
// Enforce all `aria-*` props are valid.
|
|
48
48
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-props.md
|
|
49
49
|
'jsx-a11y/aria-props': 'error',
|
|
50
50
|
|
|
@@ -60,7 +60,7 @@ const reactJsxA11yRules = {
|
|
|
60
60
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-unsupported-elements.md
|
|
61
61
|
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
62
62
|
|
|
63
|
-
// Enforce that autocomplete attributes are used correctly.
|
|
63
|
+
// Enforce that `autocomplete` attributes are used correctly.
|
|
64
64
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/autocomplete-valid.md
|
|
65
65
|
'jsx-a11y/autocomplete-valid': ['off', { inputComponents: [] }],
|
|
66
66
|
|
|
@@ -92,59 +92,59 @@ const reactJsxA11yRules = {
|
|
|
92
92
|
},
|
|
93
93
|
],
|
|
94
94
|
|
|
95
|
-
// Enforce heading (h1
|
|
95
|
+
// Enforce heading (`h1`, `h2`, etc) elements contain accessible content.
|
|
96
96
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/heading-has-content.md
|
|
97
97
|
'jsx-a11y/heading-has-content': ['error', { components: [''] }],
|
|
98
98
|
|
|
99
|
-
// Enforce
|
|
99
|
+
// Enforce `<html>` element has `lang` prop.
|
|
100
100
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/html-has-lang.md
|
|
101
101
|
'jsx-a11y/html-has-lang': 'error',
|
|
102
102
|
|
|
103
|
-
// Enforce iframe elements have a title attribute.
|
|
103
|
+
// Enforce `iframe` elements have a `title` attribute.
|
|
104
104
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/iframe-has-title.md
|
|
105
105
|
'jsx-a11y/iframe-has-title': 'error',
|
|
106
106
|
|
|
107
|
-
// Enforce
|
|
107
|
+
// Enforce `<img>` `alt` prop does not contain the word "image", "picture", or "photo".
|
|
108
108
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/img-redundant-alt.md
|
|
109
109
|
'jsx-a11y/img-redundant-alt': 'error',
|
|
110
110
|
|
|
111
|
-
// Enforce that elements with interactive handlers like onClick must be focusable.
|
|
111
|
+
// Enforce that elements with interactive handlers like `onClick` must be focusable.
|
|
112
112
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/interactive-supports-focus.md
|
|
113
113
|
'jsx-a11y/interactive-supports-focus': 'error',
|
|
114
114
|
|
|
115
|
-
// Enforce that a label tag has a text label and an associated control.
|
|
115
|
+
// Enforce that a `label` tag has a text label and an associated control.
|
|
116
116
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-associated-control.md
|
|
117
117
|
'jsx-a11y/label-has-associated-control': [
|
|
118
118
|
'error',
|
|
119
119
|
{ labelComponents: [], labelAttributes: [], controlComponents: [], assert: 'both', depth: 25 },
|
|
120
120
|
],
|
|
121
121
|
|
|
122
|
-
// Enforce that
|
|
122
|
+
// Enforce that `<label>` elements have the `htmlFor` prop.
|
|
123
123
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
|
|
124
124
|
// This rule is deprecated. It was replaced by jsx-a11y/label-has-associated-control.
|
|
125
125
|
'jsx-a11y/label-has-for': ['off', { components: [], required: { every: ['nesting', 'id'] }, allowChildren: false }],
|
|
126
126
|
|
|
127
|
-
// Enforce lang attribute has a valid value.
|
|
127
|
+
// Enforce `lang` attribute has a valid value.
|
|
128
128
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/lang.md
|
|
129
129
|
'jsx-a11y/lang': 'error',
|
|
130
130
|
|
|
131
|
-
// Enforces that
|
|
131
|
+
// Enforces that `<audio>` and `<video>` elements must have a `<track>` for captions.
|
|
132
132
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/media-has-caption.md
|
|
133
133
|
'jsx-a11y/media-has-caption': ['error', { audio: [], video: [], track: [] }],
|
|
134
134
|
|
|
135
|
-
// Enforce that onMouseOver
|
|
135
|
+
// Enforce that `onMouseOver`/`onMouseOut` are accompanied by `onFocus`/`onBlur` for keyboard-only users.
|
|
136
136
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/mouse-events-have-key-events.md
|
|
137
137
|
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
138
138
|
|
|
139
|
-
// Enforce that the accessKey prop is not used on any element to avoid complications with keyboard commands used by a screenreader.
|
|
139
|
+
// Enforce that the `accessKey` prop is not used on any element to avoid complications with keyboard commands used by a screenreader.
|
|
140
140
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-access-key.md
|
|
141
141
|
'jsx-a11y/no-access-key': 'error',
|
|
142
142
|
|
|
143
|
-
// Disallow aria-hidden="true" from being set on focusable elements.
|
|
143
|
+
// Disallow `aria-hidden="true"` from being set on focusable elements.
|
|
144
144
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-aria-hidden-on-focusable.md
|
|
145
145
|
'jsx-a11y/no-aria-hidden-on-focusable': 'off',
|
|
146
146
|
|
|
147
|
-
// Enforce autoFocus prop is not used.
|
|
147
|
+
// Enforce `autoFocus` prop is not used.
|
|
148
148
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-autofocus.md
|
|
149
149
|
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }],
|
|
150
150
|
|
|
@@ -176,21 +176,21 @@ const reactJsxA11yRules = {
|
|
|
176
176
|
},
|
|
177
177
|
],
|
|
178
178
|
|
|
179
|
-
// tabIndex should only be declared on interactive elements.
|
|
179
|
+
// `tabIndex` should only be declared on interactive elements.
|
|
180
180
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-tabindex.md
|
|
181
181
|
'jsx-a11y/no-noninteractive-tabindex': ['error', { tags: [], roles: ['tabpanel'] }],
|
|
182
182
|
|
|
183
|
-
// Enforce usage of onBlur over onChange on select menus for accessibility.
|
|
183
|
+
// Enforce usage of `onBlur` over `onChange` on select menus for accessibility.
|
|
184
184
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
|
|
185
185
|
// This rule is deprecated.
|
|
186
186
|
// Deprecated: This rule is based on reports of behavior of old browsers (eg. IE 10 and below). In the meantime, this behavior has been corrected, both in newer versions of browsers as well as in the DOM spec.
|
|
187
187
|
'jsx-a11y/no-onchange': 'off',
|
|
188
188
|
|
|
189
|
-
// Enforce explicit role property is not the same as implicit/default role property on element.
|
|
189
|
+
// Enforce explicit `role` property is not the same as implicit/default `role` property on element.
|
|
190
190
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-redundant-roles.md
|
|
191
191
|
'jsx-a11y/no-redundant-roles': 'error',
|
|
192
192
|
|
|
193
|
-
// Enforce that non-interactive, visible elements (such as
|
|
193
|
+
// Enforce that non-interactive, visible elements (such as `<div>`) that have click handlers use the `role` attribute.
|
|
194
194
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-static-element-interactions.md
|
|
195
195
|
'jsx-a11y/no-static-element-interactions': [
|
|
196
196
|
'error',
|
|
@@ -201,19 +201,19 @@ const reactJsxA11yRules = {
|
|
|
201
201
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/prefer-tag-over-role.md
|
|
202
202
|
'jsx-a11y/prefer-tag-over-role': 'off',
|
|
203
203
|
|
|
204
|
-
// Enforce that elements with ARIA roles must have all required attributes for that role
|
|
204
|
+
// Enforce that elements with ARIA roles must have all required attributes for that `role`.
|
|
205
205
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-has-required-aria-props.md
|
|
206
206
|
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
207
207
|
|
|
208
|
-
// Enforce that elements with explicit or implicit roles defined contain only aria
|
|
208
|
+
// Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`.
|
|
209
209
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-supports-aria-props.md
|
|
210
210
|
'jsx-a11y/role-supports-aria-props': 'error',
|
|
211
211
|
|
|
212
|
-
// Enforce scope prop is only used on
|
|
212
|
+
// Enforce `scope` prop is only used on `<th>` elements.
|
|
213
213
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/scope.md
|
|
214
214
|
'jsx-a11y/scope': 'error',
|
|
215
215
|
|
|
216
|
-
// Enforce tabIndex value is not greater than zero.
|
|
216
|
+
// Enforce `tabIndex` value is not greater than zero.
|
|
217
217
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/tabindex-no-positive.md
|
|
218
218
|
'jsx-a11y/tabindex-no-positive': 'error',
|
|
219
219
|
},
|
package/rules/react.js
CHANGED
|
@@ -42,7 +42,7 @@ const reactRules = {
|
|
|
42
42
|
},
|
|
43
43
|
],
|
|
44
44
|
|
|
45
|
-
// Disallow usage of button elements without an explicit type attribute
|
|
45
|
+
// Disallow usage of `button` elements without an explicit `type` attribute
|
|
46
46
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
47
47
|
'react/button-has-type': [
|
|
48
48
|
'error',
|
|
@@ -53,11 +53,11 @@ const reactRules = {
|
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
55
|
|
|
56
|
-
// Enforce using onChange or readonly attribute when checked is used
|
|
56
|
+
// Enforce using `onChange` or `readonly` attribute when `checked` is used
|
|
57
57
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md
|
|
58
58
|
'react/checked-requires-onchange-or-readonly': 'off',
|
|
59
59
|
|
|
60
|
-
// Enforce all defaultProps have a corresponding non-required PropType
|
|
60
|
+
// Enforce all `defaultProps` have a corresponding non-required `PropType`
|
|
61
61
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
|
|
62
62
|
'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
|
|
63
63
|
|
|
@@ -65,7 +65,7 @@ const reactRules = {
|
|
|
65
65
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
66
66
|
'react/destructuring-assignment': ['error', 'always'],
|
|
67
67
|
|
|
68
|
-
// Disallow missing displayName in a React component definition
|
|
68
|
+
// Disallow missing `displayName` in a React component definition
|
|
69
69
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
70
70
|
'react/display-name': 'error',
|
|
71
71
|
|
|
@@ -81,11 +81,11 @@ const reactRules = {
|
|
|
81
81
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
|
|
82
82
|
'react/forbid-elements': ['off', { forbid: [] }],
|
|
83
83
|
|
|
84
|
-
// Disallow using another component's propTypes
|
|
84
|
+
// Disallow using another component's `propTypes`
|
|
85
85
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
|
|
86
86
|
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
|
|
87
87
|
|
|
88
|
-
// Disallow certain propTypes
|
|
88
|
+
// Disallow certain `propTypes`
|
|
89
89
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
|
|
90
90
|
'react/forbid-prop-types': [
|
|
91
91
|
'error',
|
|
@@ -96,7 +96,7 @@ const reactRules = {
|
|
|
96
96
|
},
|
|
97
97
|
],
|
|
98
98
|
|
|
99
|
-
// Enforce a specific function type for function components
|
|
99
|
+
// Enforce a specific `function` type for function components
|
|
100
100
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
|
|
101
101
|
'react/function-component-definition': [
|
|
102
102
|
'error',
|
|
@@ -106,11 +106,10 @@ const reactRules = {
|
|
|
106
106
|
},
|
|
107
107
|
],
|
|
108
108
|
|
|
109
|
-
// Ensure destructuring and symmetric naming of useState hook value and setter variables
|
|
110
109
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
111
110
|
'react/hook-use-state': 'off',
|
|
112
111
|
|
|
113
|
-
// Enforce sandbox attribute on iframe elements
|
|
112
|
+
// Enforce sandbox attribute on `iframe` elements
|
|
114
113
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
|
|
115
114
|
'react/iframe-missing-sandbox': 'off',
|
|
116
115
|
|
|
@@ -203,7 +202,7 @@ const reactRules = {
|
|
|
203
202
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-newline.md
|
|
204
203
|
'react/jsx-newline': 'off',
|
|
205
204
|
|
|
206
|
-
// Disallow
|
|
205
|
+
// Disallow `.bind()` or arrow functions in JSX props
|
|
207
206
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
|
208
207
|
'react/jsx-no-bind': [
|
|
209
208
|
'error',
|
|
@@ -236,7 +235,7 @@ const reactRules = {
|
|
|
236
235
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
237
236
|
'react/jsx-no-literals': ['off', { noStrings: true }],
|
|
238
237
|
|
|
239
|
-
// Disallow usage of javascript: URLs
|
|
238
|
+
// Disallow usage of javascript: `URLs
|
|
240
239
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
|
|
241
240
|
'react/jsx-no-script-url': [
|
|
242
241
|
'error',
|
|
@@ -248,7 +247,7 @@ const reactRules = {
|
|
|
248
247
|
],
|
|
249
248
|
],
|
|
250
249
|
|
|
251
|
-
// Disallow target="_blank" attribute without rel="noreferrer"
|
|
250
|
+
// Disallow `target="_blank"` attribute without `rel="noreferrer"
|
|
252
251
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
253
252
|
'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
|
|
254
253
|
|
|
@@ -327,7 +326,7 @@ const reactRules = {
|
|
|
327
326
|
},
|
|
328
327
|
],
|
|
329
328
|
|
|
330
|
-
// Disallow React to be incorrectly marked as unused
|
|
329
|
+
// Disallow `React` to be incorrectly marked as unused
|
|
331
330
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
|
|
332
331
|
'react/jsx-uses-react': 'off',
|
|
333
332
|
|
|
@@ -350,7 +349,7 @@ const reactRules = {
|
|
|
350
349
|
},
|
|
351
350
|
],
|
|
352
351
|
|
|
353
|
-
// Disallow when this.state is accessed within setState
|
|
352
|
+
// Disallow when `this.state` is accessed within `setState`
|
|
354
353
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
|
|
355
354
|
'react/no-access-state-in-setstate': 'error',
|
|
356
355
|
|
|
@@ -358,7 +357,7 @@ const reactRules = {
|
|
|
358
357
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
|
|
359
358
|
'react/no-adjacent-inline-elements': 'off',
|
|
360
359
|
|
|
361
|
-
// Disallow usage of Array index in keys
|
|
360
|
+
// Disallow usage of `Array` index in keys
|
|
362
361
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
363
362
|
'react/no-array-index-key': 'error',
|
|
364
363
|
|
|
@@ -374,7 +373,7 @@ const reactRules = {
|
|
|
374
373
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
375
374
|
'react/no-danger': 'warn',
|
|
376
375
|
|
|
377
|
-
// Disallow when a DOM element is using both children and dangerouslySetInnerHTML
|
|
376
|
+
// Disallow when a DOM element is using both `children` and `dangerouslySetInnerHTML`
|
|
378
377
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
379
378
|
'react/no-danger-with-children': 'error',
|
|
380
379
|
|
|
@@ -382,19 +381,19 @@ const reactRules = {
|
|
|
382
381
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
|
383
382
|
'react/no-deprecated': 'error',
|
|
384
383
|
|
|
385
|
-
// Disallow usage of setState in componentDidMount
|
|
384
|
+
// Disallow usage of `setState` in `componentDidMount`
|
|
386
385
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
|
387
386
|
'react/no-did-mount-set-state': 'off',
|
|
388
387
|
|
|
389
|
-
// Disallow usage of setState in componentDidUpdate
|
|
388
|
+
// Disallow usage of `setState` in `componentDidUpdate`
|
|
390
389
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
391
390
|
'react/no-did-update-set-state': 'error',
|
|
392
391
|
|
|
393
|
-
// Disallow direct mutation of this.state
|
|
392
|
+
// Disallow direct mutation of `this.state`
|
|
394
393
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
395
394
|
'react/no-direct-mutation-state': 'error',
|
|
396
395
|
|
|
397
|
-
// Disallow usage of findDOMNode
|
|
396
|
+
// Disallow usage of `findDOMNode`
|
|
398
397
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
399
398
|
'react/no-find-dom-node': 'error',
|
|
400
399
|
|
|
@@ -402,7 +401,7 @@ const reactRules = {
|
|
|
402
401
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
|
|
403
402
|
'react/no-invalid-html-attribute': 'error',
|
|
404
403
|
|
|
405
|
-
// Disallow usage of isMounted
|
|
404
|
+
// Disallow usage of `isMounted`
|
|
406
405
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
407
406
|
'react/no-is-mounted': 'error',
|
|
408
407
|
|
|
@@ -423,15 +422,15 @@ const reactRules = {
|
|
|
423
422
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-object-type-as-default-prop.md
|
|
424
423
|
'react/no-object-type-as-default-prop': 'off',
|
|
425
424
|
|
|
426
|
-
// Disallow usage of shouldComponentUpdate when extending React.PureComponent
|
|
425
|
+
// Disallow usage of `shouldComponentUpdate` when extending `React.PureComponent`
|
|
427
426
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
|
|
428
427
|
'react/no-redundant-should-component-update': 'error',
|
|
429
428
|
|
|
430
|
-
// Disallow usage of the return value of ReactDOM.render
|
|
429
|
+
// Disallow usage of the return value of `ReactDOM.render`
|
|
431
430
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
432
431
|
'react/no-render-return-value': 'error',
|
|
433
432
|
|
|
434
|
-
// Disallow usage of setState
|
|
433
|
+
// Disallow usage of `setState`
|
|
435
434
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
|
|
436
435
|
'react/no-set-state': 'off',
|
|
437
436
|
|
|
@@ -439,7 +438,7 @@ const reactRules = {
|
|
|
439
438
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
440
439
|
'react/no-string-refs': 'error',
|
|
441
440
|
|
|
442
|
-
// Disallow this from being used in stateless functional components
|
|
441
|
+
// Disallow `this` from being used in stateless functional components
|
|
443
442
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
444
443
|
'react/no-this-in-sfc': 'error',
|
|
445
444
|
|
|
@@ -467,7 +466,7 @@ const reactRules = {
|
|
|
467
466
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md
|
|
468
467
|
'react/no-unused-class-component-methods': 'error',
|
|
469
468
|
|
|
470
|
-
// Disallow definitions of unused propTypes
|
|
469
|
+
// Disallow definitions of unused `propTypes`
|
|
471
470
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
|
|
472
471
|
'react/no-unused-prop-types': [
|
|
473
472
|
'error',
|
|
@@ -481,7 +480,7 @@ const reactRules = {
|
|
|
481
480
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
|
|
482
481
|
'react/no-unused-state': 'error',
|
|
483
482
|
|
|
484
|
-
// Disallow usage of setState in componentWillUpdate
|
|
483
|
+
// Disallow usage of `setState` in `componentWillUpdate`
|
|
485
484
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
486
485
|
'react/no-will-update-set-state': 'error',
|
|
487
486
|
|
|
@@ -489,7 +488,7 @@ const reactRules = {
|
|
|
489
488
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
490
489
|
'react/prefer-es6-class': ['error', 'always'],
|
|
491
490
|
|
|
492
|
-
// Prefer exact proptype definitions
|
|
491
|
+
// Prefer exact `proptype` definitions
|
|
493
492
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
|
|
494
493
|
'react/prefer-exact-props': 'error',
|
|
495
494
|
|
|
@@ -497,7 +496,7 @@ const reactRules = {
|
|
|
497
496
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
|
|
498
497
|
'react/prefer-read-only-props': 'off',
|
|
499
498
|
|
|
500
|
-
// Enforce stateless components to be written as a pure function
|
|
499
|
+
// Enforce stateless components to be written as a pure `function`
|
|
501
500
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
502
501
|
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
|
|
503
502
|
|
|
@@ -512,11 +511,11 @@ const reactRules = {
|
|
|
512
511
|
},
|
|
513
512
|
],
|
|
514
513
|
|
|
515
|
-
// Disallow missing React when using JSX
|
|
514
|
+
// Disallow missing `React` when using JSX
|
|
516
515
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
|
|
517
516
|
'react/react-in-jsx-scope': 'off',
|
|
518
517
|
|
|
519
|
-
// Enforce a defaultProps definition for every prop that is not a required prop
|
|
518
|
+
// Enforce a `defaultProps` definition for every prop that is not a required prop
|
|
520
519
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
|
|
521
520
|
'react/require-default-props': [
|
|
522
521
|
'error',
|
|
@@ -525,11 +524,11 @@ const reactRules = {
|
|
|
525
524
|
},
|
|
526
525
|
],
|
|
527
526
|
|
|
528
|
-
// Enforce React components to have a shouldComponentUpdate method
|
|
527
|
+
// Enforce React components to have a `shouldComponentUpdate` method
|
|
529
528
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
|
|
530
529
|
'react/require-optimization': ['off', { allowDecorators: [] }],
|
|
531
530
|
|
|
532
|
-
// Enforce ES5 or ES6 class for returning value in render function
|
|
531
|
+
// Enforce ES5 or ES6 class for returning value in `render` function
|
|
533
532
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
534
533
|
'react/require-render-return': 'error',
|
|
535
534
|
|
|
@@ -613,11 +612,11 @@ const reactRules = {
|
|
|
613
612
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
|
|
614
613
|
'react/static-property-placement': ['error', 'property assignment'],
|
|
615
614
|
|
|
616
|
-
// Enforce style prop value is an object
|
|
615
|
+
// Enforce `style` prop value is an object
|
|
617
616
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
618
617
|
'react/style-prop-object': 'error',
|
|
619
618
|
|
|
620
|
-
// Disallow void DOM elements (e.g.
|
|
619
|
+
// Disallow void DOM elements (e.g. `<img />`, `<br />`) from receiving children
|
|
621
620
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
622
621
|
'react/void-dom-elements-no-children': 'error',
|
|
623
622
|
|
|
@@ -628,7 +627,7 @@ const reactRules = {
|
|
|
628
627
|
// https://react.dev/reference/rules/rules-of-hooks
|
|
629
628
|
'react-hooks/rules-of-hooks': 'error',
|
|
630
629
|
|
|
631
|
-
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
630
|
+
// Verify the list of the dependencies for Hooks like `useEffect` and similar
|
|
632
631
|
// https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
|
|
633
632
|
// https://github.com/facebook/react/issues/14920
|
|
634
633
|
'react-hooks/exhaustive-deps': 'warn',
|
|
@@ -706,46 +705,46 @@ const reactTestRules = {
|
|
|
706
705
|
// eslint-plugin-jest-dom https://github.com/testing-library/eslint-plugin-jest-dom
|
|
707
706
|
|
|
708
707
|
// Prefer toBeChecked over checking attributes
|
|
709
|
-
//
|
|
708
|
+
// Prefer `toBeChecked` over checking attributes
|
|
710
709
|
'jest-dom/prefer-checked': 'error',
|
|
711
710
|
|
|
712
711
|
// Prefer toBeEmpty over checking innerHTML
|
|
713
|
-
//
|
|
712
|
+
// Prefer `toBeEmpty` over checking `innerHTML`
|
|
714
713
|
'jest-dom/prefer-empty': 'error',
|
|
715
714
|
|
|
716
715
|
// Prefer toBeDisabled or toBeEnabled over checking attributes
|
|
717
|
-
//
|
|
716
|
+
// Prefer `toBeDisabled` or `toBeEnabled` over checking attributes
|
|
718
717
|
'jest-dom/prefer-enabled-disabled': 'error',
|
|
719
718
|
|
|
720
719
|
// Prefer toHaveFocus over checking document.activeElement
|
|
721
|
-
//
|
|
720
|
+
// Prefer `toHaveFocus` over checking `document.activeElement`
|
|
722
721
|
'jest-dom/prefer-focus': 'error',
|
|
723
722
|
|
|
724
723
|
// Prefer .toBeInTheDocument() for asserting the existence of a DOM node
|
|
725
|
-
//
|
|
724
|
+
// Prefer `.toBeInTheDocument()` for asserting the existence of a DOM node
|
|
726
725
|
'jest-dom/prefer-in-document': 'error',
|
|
727
726
|
|
|
728
727
|
// Prefer toBeRequired over checking properties
|
|
729
|
-
//
|
|
728
|
+
// Prefer `toBeRequired` over checking properties
|
|
730
729
|
'jest-dom/prefer-required': 'error',
|
|
731
730
|
|
|
732
|
-
// Prefer toHaveAttribute over checking getAttribute
|
|
731
|
+
// Prefer `toHaveAttribute` over checking `getAttribute`/`hasAttribute`
|
|
733
732
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-attribute.md
|
|
734
733
|
'jest-dom/prefer-to-have-attribute': 'error',
|
|
735
734
|
|
|
736
|
-
// Prefer toHaveClass over checking element className
|
|
735
|
+
// Prefer `toHaveClass` over checking element `className`
|
|
737
736
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-class.md
|
|
738
737
|
'jest-dom/prefer-to-have-class': 'error',
|
|
739
738
|
|
|
740
|
-
// Prefer toHaveStyle over checking element style
|
|
739
|
+
// Prefer `toHaveStyle` over checking element `style`
|
|
741
740
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-style.md
|
|
742
741
|
'jest-dom/prefer-to-have-style': 'error',
|
|
743
742
|
|
|
744
|
-
// Prefer toHaveTextContent over checking element.textContent
|
|
743
|
+
// Prefer `toHaveTextContent` over checking `element.textContent`
|
|
745
744
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-text-content.md
|
|
746
745
|
'jest-dom/prefer-to-have-text-content': 'error',
|
|
747
746
|
|
|
748
|
-
// Prefer toHaveValue over checking element.value
|
|
747
|
+
// Prefer `toHaveValue` over checking `element.value`
|
|
749
748
|
// https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-value.md
|
|
750
749
|
'jest-dom/prefer-to-have-value': 'error',
|
|
751
750
|
|
|
@@ -799,27 +798,27 @@ const reactTestRules = {
|
|
|
799
798
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-node-access.md
|
|
800
799
|
'testing-library/no-node-access': 'error',
|
|
801
800
|
|
|
802
|
-
// Disallow the use of promises passed to a fireEvent method
|
|
801
|
+
// Disallow the use of promises passed to a `fireEvent` method
|
|
803
802
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-promise-in-fire-event.md
|
|
804
803
|
'testing-library/no-promise-in-fire-event': 'error',
|
|
805
804
|
|
|
806
|
-
// Disallow the use of render in testing frameworks setup functions
|
|
805
|
+
// Disallow the use of `render` in testing frameworks setup functions
|
|
807
806
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-render-in-lifecycle.md
|
|
808
807
|
'testing-library/no-render-in-lifecycle': 'error',
|
|
809
808
|
|
|
810
|
-
// Disallow wrapping Testing Library utils or empty callbacks in act
|
|
809
|
+
// Disallow wrapping Testing Library utils or empty callbacks in `act`
|
|
811
810
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-unnecessary-act.md
|
|
812
811
|
'testing-library/no-unnecessary-act': 'error',
|
|
813
812
|
|
|
814
|
-
// Disallow the use of multiple expect calls inside waitFor
|
|
813
|
+
// Disallow the use of multiple `expect` calls inside `waitFor`
|
|
815
814
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-multiple-assertions.md
|
|
816
815
|
'testing-library/no-wait-for-multiple-assertions': 'error',
|
|
817
816
|
|
|
818
|
-
// Disallow the use of side effects in waitFor
|
|
817
|
+
// Disallow the use of side effects in `waitFor`
|
|
819
818
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-side-effects.md
|
|
820
819
|
'testing-library/no-wait-for-side-effects': 'error',
|
|
821
820
|
|
|
822
|
-
// Ensures no snapshot is generated inside of a waitFor call
|
|
821
|
+
// Ensures no snapshot is generated inside of a `waitFor` call
|
|
823
822
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-snapshot.md
|
|
824
823
|
'testing-library/no-wait-for-snapshot': 'error',
|
|
825
824
|
|
|
@@ -827,31 +826,31 @@ const reactTestRules = {
|
|
|
827
826
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-explicit-assert.md
|
|
828
827
|
'testing-library/prefer-explicit-assert': 'off',
|
|
829
828
|
|
|
830
|
-
// Suggest using find(All)By
|
|
829
|
+
// Suggest using `find(All)By*` query instead of `waitFor` + `get(All)By*` to wait for elements
|
|
831
830
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-find-by.md
|
|
832
831
|
'testing-library/prefer-find-by': 'error',
|
|
833
832
|
|
|
834
|
-
// Suggest using implicit assertions for getBy
|
|
833
|
+
// Suggest using implicit assertions for `getBy*` & `findBy*` queries
|
|
835
834
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-implicit-assert.md
|
|
836
835
|
'testing-library/prefer-implicit-assert': 'off',
|
|
837
836
|
|
|
838
|
-
// Ensure appropriate get
|
|
837
|
+
// Ensure appropriate `get*`/`query*` queries are used with their respective matchers
|
|
839
838
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-presence-queries.md
|
|
840
839
|
'testing-library/prefer-presence-queries': 'error',
|
|
841
840
|
|
|
842
|
-
// Suggest using queryBy
|
|
841
|
+
// Suggest using `queryBy*` queries when waiting for disappearance
|
|
843
842
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-query-by-disappearance.md
|
|
844
843
|
'testing-library/prefer-query-by-disappearance': 'error',
|
|
845
844
|
|
|
846
|
-
// Ensure the configured get
|
|
845
|
+
// Ensure the configured `get*`/`query*` query is used with the corresponding matchers
|
|
847
846
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-query-matchers.md
|
|
848
847
|
'testing-library/prefer-query-matchers': 'error',
|
|
849
848
|
|
|
850
|
-
// Suggest using screen while querying
|
|
849
|
+
// Suggest using `screen` while querying
|
|
851
850
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md
|
|
852
851
|
'testing-library/prefer-screen-queries': 'error',
|
|
853
852
|
|
|
854
|
-
// Suggest using userEvent over fireEvent for simulating user interactions
|
|
853
|
+
// Suggest using `userEvent` over `fireEvent` for simulating user interactions
|
|
855
854
|
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-user-event.md
|
|
856
855
|
'testing-library/prefer-user-event': 'off',
|
|
857
856
|
|