@qlik/eslint-config 1.4.28 → 2.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,232 +0,0 @@
1
- // @ts-check
2
-
3
- /**
4
- * @satisfies {import("../../types/index.js").ESLintFlatConfig["rules"]}
5
- */
6
- const rules = {
7
- // Enforce that all elements that require alternative text have meaningful information
8
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
9
- "jsx-a11y/alt-text": [
10
- "error",
11
- {
12
- elements: ["img", "object", "area", 'input[type="image"]'],
13
- img: [],
14
- object: [],
15
- area: [],
16
- 'input[type="image"]': [],
17
- },
18
- ],
19
-
20
- // Enforce that anchors have content
21
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md
22
- "jsx-a11y/anchor-has-content": ["error", { components: [] }],
23
-
24
- // ensure <a> tags are valid
25
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md
26
- "jsx-a11y/anchor-is-valid": [
27
- "error",
28
- {
29
- components: ["Link"],
30
- specialLink: ["to"],
31
- aspects: ["noHref", "invalidHref", "preferButton"],
32
- },
33
- ],
34
-
35
- // elements with aria-activedescendant must be tabbable
36
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md
37
- "jsx-a11y/aria-activedescendant-has-tabindex": "error",
38
-
39
- // Enforce all aria-* props are valid.
40
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md
41
- "jsx-a11y/aria-props": "error",
42
-
43
- // Enforce ARIA state and property values are valid.
44
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md
45
- "jsx-a11y/aria-proptypes": "error",
46
-
47
- // Require ARIA roles to be valid and non-abstract
48
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md
49
- "jsx-a11y/aria-role": ["error", { ignoreNonDOM: false }],
50
-
51
- // Enforce that elements that do not support ARIA roles, states, and
52
- // properties do not have those attributes.
53
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md
54
- "jsx-a11y/aria-unsupported-elements": "error",
55
-
56
- // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
57
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md
58
- "jsx-a11y/click-events-have-key-events": "error",
59
-
60
- // Enforce that a control (an interactive element) has a text label.
61
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md
62
- "jsx-a11y/control-has-associated-label": [
63
- "error",
64
- {
65
- labelAttributes: ["label"],
66
- controlComponents: [],
67
- ignoreElements: ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
68
- ignoreRoles: [
69
- "grid",
70
- "listbox",
71
- "menu",
72
- "menubar",
73
- "radiogroup",
74
- "row",
75
- "tablist",
76
- "toolbar",
77
- "tree",
78
- "treegrid",
79
- ],
80
- depth: 5,
81
- },
82
- ],
83
-
84
- // ensure <hX> tags have content and are not aria-hidden
85
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md
86
- "jsx-a11y/heading-has-content": ["error", { components: [""] }],
87
-
88
- // require HTML elements to have a "lang" prop
89
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md
90
- "jsx-a11y/html-has-lang": "error",
91
-
92
- // ensure iframe elements have a unique title
93
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md
94
- "jsx-a11y/iframe-has-title": "error",
95
-
96
- // Prevent img alt text from containing redundant words like "image", "picture", or "photo"
97
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md
98
- "jsx-a11y/img-redundant-alt": "error",
99
-
100
- // Elements with an interactive role and interaction handlers must be focusable
101
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md
102
- "jsx-a11y/interactive-supports-focus": "error",
103
-
104
- // Enforce that a label tag has a text label and an associated control.
105
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/b800f40a2a69ad48015ae9226fbe879f946757ed/docs/rules/label-has-associated-control.md
106
- "jsx-a11y/label-has-associated-control": [
107
- "error",
108
- {
109
- labelComponents: [],
110
- labelAttributes: [],
111
- controlComponents: [],
112
- assert: "both",
113
- depth: 25,
114
- },
115
- ],
116
-
117
- // require HTML element's lang prop to be valid
118
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/lang.md
119
- "jsx-a11y/lang": "error",
120
-
121
- // media elements must have captions
122
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md
123
- "jsx-a11y/media-has-caption": [
124
- "error",
125
- {
126
- audio: [],
127
- video: [],
128
- track: [],
129
- },
130
- ],
131
-
132
- // require that mouseover/out come with focus/blur, for keyboard-only users
133
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
134
- "jsx-a11y/mouse-events-have-key-events": "error",
135
-
136
- // Prevent use of `accessKey`
137
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md
138
- "jsx-a11y/no-access-key": "error",
139
-
140
- // prohibit autoFocus prop
141
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md
142
- "jsx-a11y/no-autofocus": ["error", { ignoreNonDOM: true }],
143
-
144
- // prevent distracting elements, like <marquee> and <blink>
145
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md
146
- "jsx-a11y/no-distracting-elements": [
147
- "error",
148
- {
149
- elements: ["marquee", "blink"],
150
- },
151
- ],
152
-
153
- // WAI-ARIA roles should not be used to convert an interactive element to non-interactive
154
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md
155
- "jsx-a11y/no-interactive-element-to-noninteractive-role": [
156
- "error",
157
- {
158
- tr: ["none", "presentation"],
159
- },
160
- ],
161
-
162
- // A non-interactive element does not support event handlers (mouse and key handlers)
163
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md
164
- "jsx-a11y/no-noninteractive-element-interactions": [
165
- "error",
166
- {
167
- handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
168
- },
169
- ],
170
-
171
- // WAI-ARIA roles should not be used to convert a non-interactive element to interactive
172
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md
173
- "jsx-a11y/no-noninteractive-element-to-interactive-role": [
174
- "error",
175
- {
176
- ul: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
177
- ol: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
178
- li: ["menuitem", "option", "row", "tab", "treeitem"],
179
- table: ["grid"],
180
- td: ["gridcell"],
181
- },
182
- ],
183
-
184
- // Tab key navigation should be limited to elements on the page that can be interacted with.
185
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md
186
- "jsx-a11y/no-noninteractive-tabindex": [
187
- "error",
188
- {
189
- tags: [],
190
- roles: ["tabpanel"],
191
- allowExpressionValues: true,
192
- },
193
- ],
194
-
195
- // ensure HTML elements do not specify redundant ARIA roles
196
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md
197
- "jsx-a11y/no-redundant-roles": [
198
- "error",
199
- {
200
- nav: ["navigation"],
201
- },
202
- ],
203
-
204
- // Enforce that DOM elements without semantic behavior not have interaction handlers
205
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md
206
- "jsx-a11y/no-static-element-interactions": [
207
- "error",
208
- {
209
- handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
210
- },
211
- ],
212
-
213
- // Enforce that elements with ARIA roles must have all required attributes
214
- // for that role.
215
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md
216
- "jsx-a11y/role-has-required-aria-props": "error",
217
-
218
- // Enforce that elements with explicit or implicit roles defined contain
219
- // only aria-* properties supported by that role.
220
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md
221
- "jsx-a11y/role-supports-aria-props": "error",
222
-
223
- // only allow <th> to have the "scope" attr
224
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md
225
- "jsx-a11y/scope": "error",
226
-
227
- // Enforce tabIndex value is not greater than zero.
228
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md
229
- "jsx-a11y/tabindex-no-positive": "error",
230
- };
231
-
232
- export default rules;
@@ -1,12 +0,0 @@
1
- // @ts-check
2
-
3
- /**
4
- * Overrides for the recommended ruleset we use from eslint-plugin-react-hooks.
5
- *
6
- * @satisfies {import("../../types/index.js").ESLintFlatConfig["rules"]}
7
- */
8
- const rules = {
9
- "react-hooks/exhaustive-deps": "error",
10
- };
11
-
12
- export default rules;
@@ -1,424 +0,0 @@
1
- // @ts-check
2
-
3
- /**
4
- * @satisfies {import("../../types/index.js").ESLintFlatConfig["rules"]}
5
- */
6
- const rules = {
7
- "class-methods-use-this": [
8
- "warn",
9
- {
10
- exceptMethods: [
11
- "render",
12
- "getInitialState",
13
- "getDefaultProps",
14
- "getChildContext",
15
- "componentWillMount",
16
- "UNSAFE_componentWillMount",
17
- "componentDidMount",
18
- "componentWillReceiveProps",
19
- "UNSAFE_componentWillReceiveProps",
20
- "shouldComponentUpdate",
21
- "componentWillUpdate",
22
- "UNSAFE_componentWillUpdate",
23
- "componentDidUpdate",
24
- "componentWillUnmount",
25
- "componentDidCatch",
26
- "getSnapshotBeforeUpdate",
27
- ],
28
- },
29
- ],
30
-
31
- // Forbid certain propTypes (any, array, object)
32
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
33
- "react/forbid-prop-types": [
34
- "error",
35
- {
36
- forbid: ["any", "array", "object"],
37
- checkContextTypes: true,
38
- checkChildContextTypes: true,
39
- },
40
- ],
41
-
42
- // Enforce boolean attributes notation in JSX
43
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
44
- "react/jsx-boolean-value": ["error", "never", { always: [] }],
45
-
46
- // Prevent usage of .bind() in JSX props
47
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
48
- "react/jsx-no-bind": [
49
- "error",
50
- {
51
- ignoreRefs: true,
52
- allowArrowFunctions: true,
53
- allowFunctions: false,
54
- allowBind: false,
55
- ignoreDOMComponents: true,
56
- },
57
- ],
58
-
59
- // Prevent duplicate props in JSX
60
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
61
- "react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
62
-
63
- // Disallow undeclared variables in JSX
64
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
65
- "react/jsx-no-undef": "error",
66
-
67
- // Enforce PascalCase for user-defined JSX components
68
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
69
- "react/jsx-pascal-case": [
70
- "error",
71
- {
72
- allowAllCaps: true,
73
- ignore: [],
74
- },
75
- ],
76
-
77
- // Prevent React to be incorrectly marked as unused
78
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
79
- "react/jsx-uses-react": "off",
80
-
81
- // Prevent variables used in JSX to be incorrectly marked as unused
82
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
83
- "react/jsx-uses-vars": "error",
84
-
85
- // Prevent usage of dangerous JSX properties
86
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
87
- "react/no-danger": "warn",
88
-
89
- // Prevent usage of deprecated methods
90
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
91
- "react/no-deprecated": ["error"],
92
-
93
- // Prevent usage of setState in componentDidUpdate
94
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
95
- "react/no-did-update-set-state": "error",
96
-
97
- // Prevent usage of setState in componentWillUpdate
98
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
99
- "react/no-will-update-set-state": "error",
100
-
101
- // Prevent usage of isMounted
102
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
103
- "react/no-is-mounted": "error",
104
-
105
- // Prevent using string references
106
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
107
- "react/no-string-refs": "error",
108
-
109
- // Prevent usage of unknown DOM property
110
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
111
- "react/no-unknown-property": "error",
112
-
113
- // Require ES6 class declarations over React.createClass
114
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
115
- "react/prefer-es6-class": ["error", "always"],
116
-
117
- // Require stateless functions when not using lifecycle methods, setState or ref
118
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
119
- "react/prefer-stateless-function": ["error", { ignorePureComponents: true }],
120
-
121
- // Prevent missing props validation in a React component definition
122
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md
123
- "react/prop-types": [
124
- "error",
125
- {
126
- ignore: [],
127
- customValidators: [],
128
- skipUndeclared: false,
129
- },
130
- ],
131
-
132
- // Prevent missing React when using JSX
133
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
134
- "react/react-in-jsx-scope": "off",
135
-
136
- // Require render() methods to return something
137
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
138
- "react/require-render-return": "error",
139
-
140
- // Prevent extra closing tags for components without children
141
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
142
- "react/self-closing-comp": "error",
143
-
144
- // Enforce component methods order
145
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
146
- "react/sort-comp": [
147
- "error",
148
- {
149
- order: [
150
- "static-variables",
151
- "static-methods",
152
- "instance-variables",
153
- "lifecycle",
154
- "/^handle.+$/",
155
- "/^on.+$/",
156
- "getters",
157
- "setters",
158
- "/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
159
- "instance-methods",
160
- "everything-else",
161
- "rendering",
162
- ],
163
- groups: {
164
- lifecycle: [
165
- "displayName",
166
- "propTypes",
167
- "contextTypes",
168
- "childContextTypes",
169
- "mixins",
170
- "statics",
171
- "defaultProps",
172
- "constructor",
173
- "getDefaultProps",
174
- "getInitialState",
175
- "state",
176
- "getChildContext",
177
- "getDerivedStateFromProps",
178
- "componentWillMount",
179
- "UNSAFE_componentWillMount",
180
- "componentDidMount",
181
- "componentWillReceiveProps",
182
- "UNSAFE_componentWillReceiveProps",
183
- "shouldComponentUpdate",
184
- "componentWillUpdate",
185
- "UNSAFE_componentWillUpdate",
186
- "getSnapshotBeforeUpdate",
187
- "componentDidUpdate",
188
- "componentDidCatch",
189
- "componentWillUnmount",
190
- ],
191
- rendering: ["/^render.+$/", "render"],
192
- },
193
- },
194
- ],
195
-
196
- // Prevent missing parentheses around multilines JSX
197
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
198
- "react/jsx-wrap-multilines": "off",
199
-
200
- // Stylistic, Prettier handles this.
201
- // Enforce spacing around jsx equals signs
202
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
203
- "react/jsx-equals-spacing": "off",
204
-
205
- // Stylistic, Prettier handles this.
206
- // Enforce JSX indentation
207
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
208
- "react/jsx-indent": "off",
209
-
210
- // Disallow target="_blank" on links
211
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
212
- "react/jsx-no-target-blank": ["error", { enforceDynamicLinks: "always" }],
213
-
214
- // only .jsx files may have JSX
215
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
216
- "react/jsx-filename-extension": ["error", { extensions: [".jsx"] }],
217
-
218
- // prevent accidental JS comments from being injected into JSX as text
219
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
220
- "react/jsx-no-comment-textnodes": "error",
221
-
222
- // disallow using React.render/ReactDOM.render's return value
223
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
224
- "react/no-render-return-value": "error",
225
-
226
- // warn against using findDOMNode()
227
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
228
- "react/no-find-dom-node": "error",
229
-
230
- // Prevent problem with children and props.dangerouslySetInnerHTML
231
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
232
- "react/no-danger-with-children": "error",
233
-
234
- // Prevent unused propType definitions
235
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
236
- "react/no-unused-prop-types": [
237
- "error",
238
- {
239
- customValidators: [],
240
- skipShapeProps: true,
241
- },
242
- ],
243
-
244
- // Require style prop value be an object or var
245
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
246
- "react/style-prop-object": "error",
247
-
248
- // Prevent invalid characters from appearing in markup
249
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
250
- "react/no-unescaped-entities": "error",
251
-
252
- // Prevent passing of children as props
253
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
254
- "react/no-children-prop": "error",
255
-
256
- // Validate whitespace in and around the JSX opening and closing brackets
257
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
258
- "react/jsx-tag-spacing": "off",
259
-
260
- // Prevent usage of Array index in keys
261
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
262
- "react/no-array-index-key": "error",
263
-
264
- // We dont use `.defaultProps` any more, we use fallbacks on props (`{ foo = "bar" }`)
265
- // Enforce a defaultProps definition for every prop that is not a required prop
266
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
267
- "react/require-default-props": "off",
268
-
269
- // Forbids using non-exported propTypes
270
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
271
- // this is intentionally set to "warn". it would be "error",
272
- // but it's only critical if you're stripping propTypes in production.
273
- "react/forbid-foreign-prop-types": ["warn", { allowInPropTypes: true }],
274
-
275
- // Prevent void DOM elements from receiving children
276
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
277
- "react/void-dom-elements-no-children": "error",
278
-
279
- // Enforce all defaultProps have a corresponding non-required PropType
280
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
281
- "react/default-props-match-prop-types": ["error", { allowRequiredDefaults: false }],
282
-
283
- // Prevent usage of shouldComponentUpdate when extending React.PureComponent
284
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
285
- "react/no-redundant-should-component-update": "error",
286
-
287
- // Prevent unused state values
288
- // https://github.com/jsx-eslint/eslint-plugin-react/pull/1103/
289
- "react/no-unused-state": "error",
290
-
291
- // Prevents common casing typos
292
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md
293
- "react/no-typos": "error",
294
-
295
- // Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
296
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
297
- "react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
298
-
299
- // Stylistic, Prettier handles this.
300
- // One JSX Element Per Line
301
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
302
- "react/jsx-one-expression-per-line": "off",
303
-
304
- // Enforce consistent usage of destructuring assignment of props, state, and context
305
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
306
- "react/destructuring-assignment": ["error", "always"],
307
-
308
- // Prevent using this.state within a this.setState
309
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
310
- "react/no-access-state-in-setstate": "error",
311
-
312
- // Prevent usage of button elements without an explicit type attribute
313
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
314
- "react/button-has-type": [
315
- "error",
316
- {
317
- button: true,
318
- submit: true,
319
- reset: false,
320
- },
321
- ],
322
-
323
- // Prevent this from being used in stateless functional components
324
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
325
- "react/no-this-in-sfc": "error",
326
-
327
- // Disallow multiple spaces between inline JSX props
328
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
329
- "react/jsx-props-no-multi-spaces": "off",
330
-
331
- // Enforce shorthand or standard form for React fragments
332
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
333
- "react/jsx-fragments": ["error", "syntax"],
334
-
335
- // Enforce state initialization style
336
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
337
- "react/state-in-constructor": ["error", "never"],
338
-
339
- // Enforces where React component static properties should be positioned
340
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
341
- "react/static-property-placement": "error",
342
-
343
- // This has valid cases but best practice to be explicit about the props
344
- // Disallow JSX props spreading
345
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
346
- "react/jsx-props-no-spreading": [
347
- "off",
348
- {
349
- html: "enforce",
350
- custom: "enforce",
351
- explicitSpread: "ignore",
352
- exceptions: [],
353
- },
354
- ],
355
-
356
- // Prevent usage of `javascript:` URLs
357
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
358
- "react/jsx-no-script-url": [
359
- "error",
360
- [
361
- {
362
- name: "Link",
363
- props: ["to"],
364
- },
365
- ],
366
- ],
367
-
368
- // Disallow unnecessary fragments
369
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
370
- "react/jsx-no-useless-fragment": "error",
371
-
372
- // Stylistic rule
373
- // Enforce a specific function type for function components
374
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
375
- "react/function-component-definition": "off",
376
-
377
- // Prevent react contexts from taking non-stable values
378
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
379
- "react/jsx-no-constructed-context-values": "error",
380
-
381
- // Prevent creating unstable components inside components
382
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
383
- "react/no-unstable-nested-components": "error",
384
-
385
- // Enforce that namespaces are not used in React elements
386
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-namespace.md
387
- "react/no-namespace": "error",
388
-
389
- // Prefer exact proptype definitions
390
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
391
- "react/prefer-exact-props": "error",
392
-
393
- // Lifecycle methods should be methods on the prototype, not class fields
394
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md
395
- "react/no-arrow-function-lifecycle": "error",
396
-
397
- // Prevent usage of invalid attributes
398
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
399
- "react/no-invalid-html-attribute": "error",
400
-
401
- // Prevent declaring unused methods of component class
402
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md
403
- "react/no-unused-class-component-methods": "error",
404
-
405
- // Ensure destructuring and symmetric naming of useState hook value and setter variables
406
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
407
- "react/hook-use-state": "error",
408
-
409
- // Prevent problematic leaked values from being rendered
410
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
411
- "react/jsx-no-leaked-render": "error",
412
-
413
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-object-type-as-default-prop.md
414
-
415
- "react/no-object-type-as-default-prop": "error",
416
-
417
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forward-ref-uses-ref.md
418
- "react/forward-ref-uses-ref": "error",
419
-
420
- // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spread-multi.md
421
- "react/jsx-props-no-spread-multi": "error",
422
- };
423
-
424
- export default rules;