@wistia/eslint-config 2.4.6 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CODEOWNERS +3 -0
- package/.github/workflows/publish-branch-package.yml +1 -1
- package/.yarn/releases/yarn-4.13.0.cjs +940 -0
- package/.yarnrc.yml +3 -3
- package/CHANGELOG.md +14 -0
- package/README.md +7 -0
- package/package.json +7 -7
- package/src/rules/base.mjs +6 -3
- package/src/rules/react.mjs +142 -58
- package/src/rules/typescript.mjs +6 -2
- package/test/__snapshots__/javascript.mjs.snap +4 -4
- package/test/__snapshots__/react.mjs.snap +43 -55
- package/test/__snapshots__/typescript.mjs.snap +6 -6
- package/.yarn/releases/yarn-4.12.0.cjs +0 -942
package/.yarnrc.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @wistia/eslint-config
|
|
2
2
|
|
|
3
|
+
## 2.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#469](https://github.com/wistia/eslint-config/pull/469) [`a0498f9`](https://github.com/wistia/eslint-config/commit/a0498f9fc88d5039a943cce54f2660df4e006cfe) Thanks [@jetpackjarrett](https://github.com/jetpackjarrett)! - feat: turn off deprecated rules
|
|
8
|
+
|
|
9
|
+
- [#469](https://github.com/wistia/eslint-config/pull/471) [`a0498f9`](https://github.com/wistia/eslint-config/commit/d6dd3e3644ef00115b4c703a133f70cd8ad64e79) Thanks [@okize](https://github.com/okize)! - feat: update `react` rules
|
|
10
|
+
|
|
11
|
+
## 2.4.7
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#463](https://github.com/wistia/eslint-config/pull/463) [`96f0593`](https://github.com/wistia/eslint-config/commit/96f0593748b91e9501ac31a77b8fca7c1f96fbdc) Thanks [@okize](https://github.com/okize)! - fix: disable `non-nullable-type-assertion-style` to resolve conflict with `no-non-null-assertion`
|
|
16
|
+
|
|
3
17
|
## 2.4.6
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -17,3 +17,10 @@ Wistia's ESLint configuration. This repo is "pseudo-public" - private on our org
|
|
|
17
17
|
## Configs
|
|
18
18
|
|
|
19
19
|
configs are additive, so start with a base config, either `@wistia/eslint-config` or `@wistia/eslint-config/typescript` and then apply further configs as desired.
|
|
20
|
+
|
|
21
|
+
## Philosophy & Principles
|
|
22
|
+
|
|
23
|
+
- **Always Error, Never Warn:** Warnings become background noise that developers tune out. A rule should either flag a real problem or stay silent.
|
|
24
|
+
- **Strict, Consistent Code Style:** Where there's more than one way to do something, this configuration picks the strictest and most uniform option, favoring modern syntax and established best practices.
|
|
25
|
+
- **Fast:** Known performance-heavy rules are skipped.
|
|
26
|
+
- **Don't get in the way:** Rules that involve style preferences are intentionally disabled as this is best left to a formatter like `prettier`. Whenever possible, rules that can auto-fix are chosen to minimize friction and save developer time.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
|
-
"packageManager": "yarn@4.
|
|
5
|
+
"packageManager": "yarn@4.13.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.mjs",
|
|
8
8
|
"engines": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"test:export": "check-export-map"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@eslint-react/eslint-plugin": "^
|
|
41
|
+
"@eslint-react/eslint-plugin": "^4.2.3",
|
|
42
42
|
"@eslint/compat": "^2.0.3",
|
|
43
43
|
"@eslint/js": "^10.0.1",
|
|
44
44
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
46
|
-
"@typescript-eslint/parser": "^8.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
46
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
47
47
|
"@vitest/eslint-plugin": "^1.6.13",
|
|
48
48
|
"confusing-browser-globals": "^1.0.11",
|
|
49
49
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"eslint-plugin-styled-components-a11y": "^2.2.1",
|
|
65
65
|
"eslint-plugin-testing-library": "^7.16.2",
|
|
66
66
|
"globals": "^17.4.0",
|
|
67
|
-
"globals-vitest": "^4.1.
|
|
67
|
+
"globals-vitest": "^4.1.2"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@changesets/changelog-github": "^0.6.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"prettier": "^3.8.1",
|
|
79
79
|
"storybook": "^10.3.3",
|
|
80
80
|
"typescript": "^6.0.2",
|
|
81
|
-
"vitest": "^4.1.
|
|
81
|
+
"vitest": "^4.1.2"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"eslint": ">= 10",
|
package/src/rules/base.mjs
CHANGED
|
@@ -65,7 +65,8 @@ export default {
|
|
|
65
65
|
|
|
66
66
|
// Disallow duplicate arguments in function definitions
|
|
67
67
|
// https://eslint.org/docs/rules/no-dupe-args
|
|
68
|
-
|
|
68
|
+
// decision: superseded by strict mode
|
|
69
|
+
'no-dupe-args': 'off',
|
|
69
70
|
|
|
70
71
|
// Disallow duplicate class members
|
|
71
72
|
// https://eslint.org/docs/rules/no-dupe-class-members
|
|
@@ -611,11 +612,13 @@ export default {
|
|
|
611
612
|
|
|
612
613
|
// Disallow octal literals
|
|
613
614
|
// https://eslint.org/docs/rules/no-octal
|
|
614
|
-
|
|
615
|
+
// decision: superseded by strict mode
|
|
616
|
+
'no-octal': 'off',
|
|
615
617
|
|
|
616
618
|
// Disallow octal escape sequences in string literals
|
|
617
619
|
// https://eslint.org/docs/rules/no-octal-escape
|
|
618
|
-
|
|
620
|
+
// decision: superseded by strict mode
|
|
621
|
+
'no-octal-escape': 'off',
|
|
619
622
|
|
|
620
623
|
// Disallow reassigning function parameters
|
|
621
624
|
// https://eslint.org/docs/rules/no-param-reassign
|
package/src/rules/react.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @eslint-react rules
|
|
2
|
-
// see: https://
|
|
2
|
+
// see: https://eslint-react.xyz/docs/rules
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
// Enforce that class methods utilize this
|
|
@@ -31,289 +31,373 @@ export default {
|
|
|
31
31
|
// --- Core React rules ---
|
|
32
32
|
|
|
33
33
|
// Validates higher order functions defining nested components or hooks
|
|
34
|
+
// https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
34
35
|
'@eslint-react/component-hook-factories': 'error',
|
|
35
36
|
|
|
36
37
|
// Validates usage of Error Boundaries instead of try/catch for child errors
|
|
38
|
+
// https://eslint-react.xyz/docs/rules/error-boundaries
|
|
37
39
|
'@eslint-react/error-boundaries': 'error',
|
|
38
40
|
|
|
39
41
|
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
42
|
+
// https://eslint-react.xyz/docs/rules/exhaustive-deps
|
|
40
43
|
'@eslint-react/exhaustive-deps': 'error',
|
|
41
44
|
|
|
42
45
|
// Validates against mutating props, state, and other immutable values
|
|
46
|
+
// https://eslint-react.xyz/docs/rules/immutability
|
|
43
47
|
'@eslint-react/immutability': 'error',
|
|
44
48
|
|
|
45
|
-
// Prevents unintentional '$' sign before expression in JSX
|
|
46
|
-
'@eslint-react/jsx-dollar': 'error',
|
|
47
|
-
|
|
48
|
-
// Enforce key prop comes before spread to avoid overriding
|
|
49
|
-
'@eslint-react/jsx-key-before-spread': 'error',
|
|
50
|
-
|
|
51
|
-
// Prevent accidental JS comments from being injected into JSX as text
|
|
52
|
-
'@eslint-react/jsx-no-comment-textnodes': 'error',
|
|
53
|
-
|
|
54
|
-
// Enforce explicit boolean prop syntax (e.g. disabled={true} instead of disabled)
|
|
55
|
-
// note: -1 means "never use shorthand" (equivalent to react/jsx-boolean-value: ['error', 'always'])
|
|
56
|
-
'@eslint-react/jsx-shorthand-boolean': ['error', -1],
|
|
57
|
-
|
|
58
|
-
// Enforce shorthand fragment syntax (<> instead of <React.Fragment>)
|
|
59
|
-
// note: 1 means "always use shorthand" (equivalent to react/jsx-fragments: ['error', 'syntax'])
|
|
60
|
-
'@eslint-react/jsx-shorthand-fragment': ['error', 1],
|
|
61
|
-
|
|
62
49
|
// Prevent using this.state within a this.setState
|
|
50
|
+
// https://eslint-react.xyz/docs/rules/no-access-state-in-setstate
|
|
63
51
|
'@eslint-react/no-access-state-in-setstate': 'error',
|
|
64
52
|
|
|
65
53
|
// Prevent usage of Array index in keys
|
|
54
|
+
// https://eslint-react.xyz/docs/rules/no-array-index-key
|
|
66
55
|
'@eslint-react/no-array-index-key': 'error',
|
|
67
56
|
|
|
68
57
|
// Disallow usage of Children.count
|
|
58
|
+
// https://eslint-react.xyz/docs/rules/no-children-count
|
|
69
59
|
'@eslint-react/no-children-count': 'error',
|
|
70
60
|
|
|
71
61
|
// Disallow usage of Children.forEach
|
|
62
|
+
// https://eslint-react.xyz/docs/rules/no-children-for-each
|
|
72
63
|
'@eslint-react/no-children-for-each': 'error',
|
|
73
64
|
|
|
74
65
|
// Disallow usage of Children.map
|
|
66
|
+
// https://eslint-react.xyz/docs/rules/no-children-map
|
|
75
67
|
'@eslint-react/no-children-map': 'error',
|
|
76
68
|
|
|
77
69
|
// Disallow usage of Children.only
|
|
70
|
+
// https://eslint-react.xyz/docs/rules/no-children-only
|
|
78
71
|
'@eslint-react/no-children-only': 'error',
|
|
79
72
|
|
|
80
|
-
// Prevent passing of children as props
|
|
81
|
-
'@eslint-react/no-children-prop': 'error',
|
|
82
|
-
|
|
83
73
|
// Disallow usage of Children.toArray
|
|
74
|
+
// https://eslint-react.xyz/docs/rules/no-children-to-array
|
|
84
75
|
'@eslint-react/no-children-to-array': 'error',
|
|
85
76
|
|
|
86
77
|
// Disallow class components (except for error boundaries)
|
|
78
|
+
// https://eslint-react.xyz/docs/rules/no-class-component
|
|
87
79
|
'@eslint-react/no-class-component': 'error',
|
|
88
80
|
|
|
89
81
|
// Disallow usage of cloneElement
|
|
82
|
+
// https://eslint-react.xyz/docs/rules/no-clone-element
|
|
90
83
|
'@eslint-react/no-clone-element': 'error',
|
|
91
84
|
|
|
92
85
|
// Disallow usage of componentWillMount
|
|
86
|
+
// https://eslint-react.xyz/docs/rules/no-component-will-mount
|
|
93
87
|
'@eslint-react/no-component-will-mount': 'error',
|
|
94
88
|
|
|
95
89
|
// Disallow usage of componentWillReceiveProps
|
|
90
|
+
// https://eslint-react.xyz/docs/rules/no-component-will-receive-props
|
|
96
91
|
'@eslint-react/no-component-will-receive-props': 'error',
|
|
97
92
|
|
|
98
93
|
// Disallow usage of componentWillUpdate
|
|
94
|
+
// https://eslint-react.xyz/docs/rules/no-component-will-update
|
|
99
95
|
'@eslint-react/no-component-will-update': 'error',
|
|
100
96
|
|
|
101
97
|
// Disallow usage of legacy Context.Provider (React 19+)
|
|
98
|
+
// https://eslint-react.xyz/docs/rules/no-context-provider
|
|
102
99
|
'@eslint-react/no-context-provider': 'error',
|
|
103
100
|
|
|
104
101
|
// Disallow usage of createRef (prefer useRef)
|
|
102
|
+
// https://eslint-react.xyz/docs/rules/no-create-ref
|
|
105
103
|
'@eslint-react/no-create-ref': 'error',
|
|
106
104
|
|
|
107
105
|
// Prevent direct mutation of this.state
|
|
106
|
+
// https://eslint-react.xyz/docs/rules/no-direct-mutation-state
|
|
108
107
|
'@eslint-react/no-direct-mutation-state': 'error',
|
|
109
108
|
|
|
110
109
|
// Disallow duplicate keys in JSX arrays
|
|
110
|
+
// https://eslint-react.xyz/docs/rules/no-duplicate-key
|
|
111
111
|
'@eslint-react/no-duplicate-key': 'error',
|
|
112
112
|
|
|
113
113
|
// Disallow usage of forwardRef (React 19+ passes ref as prop)
|
|
114
|
+
// https://eslint-react.xyz/docs/rules/no-forward-ref
|
|
114
115
|
'@eslint-react/no-forward-ref': 'error',
|
|
115
116
|
|
|
116
117
|
// Prevent implicitly passing the children prop
|
|
118
|
+
// https://eslint-react.xyz/docs/rules/no-implicit-children
|
|
117
119
|
'@eslint-react/no-implicit-children': 'error',
|
|
118
120
|
|
|
119
121
|
// Prevent implicitly passing the key prop
|
|
122
|
+
// https://eslint-react.xyz/docs/rules/no-implicit-key
|
|
120
123
|
'@eslint-react/no-implicit-key': 'error',
|
|
121
124
|
|
|
122
125
|
// Prevent implicitly passing the ref prop
|
|
126
|
+
// https://eslint-react.xyz/docs/rules/no-implicit-ref
|
|
123
127
|
'@eslint-react/no-implicit-ref': 'error',
|
|
124
128
|
|
|
125
129
|
// Prevent problematic leaked values from being rendered
|
|
130
|
+
// https://eslint-react.xyz/docs/rules/no-leaked-conditional-rendering
|
|
126
131
|
'@eslint-react/no-leaked-conditional-rendering': 'error',
|
|
127
132
|
|
|
128
133
|
// Enforce that components have a displayName for DevTools
|
|
134
|
+
// https://eslint-react.xyz/docs/rules/no-missing-component-display-name
|
|
129
135
|
'@eslint-react/no-missing-component-display-name': 'off',
|
|
130
136
|
|
|
131
137
|
// Enforce that contexts have a displayName for DevTools
|
|
138
|
+
// https://eslint-react.xyz/docs/rules/no-missing-context-display-name
|
|
132
139
|
'@eslint-react/no-missing-context-display-name': 'off',
|
|
133
140
|
|
|
134
141
|
// Enforce that every JSX element in a list has a key prop
|
|
142
|
+
// https://eslint-react.xyz/docs/rules/no-missing-key
|
|
135
143
|
'@eslint-react/no-missing-key': 'error',
|
|
136
144
|
|
|
137
145
|
// Disallow misusing captureOwnerStack
|
|
146
|
+
// https://eslint-react.xyz/docs/rules/no-misused-capture-owner-stack
|
|
138
147
|
'@eslint-react/no-misused-capture-owner-stack': 'error',
|
|
139
148
|
|
|
140
149
|
// Prevent creating unstable components inside components
|
|
150
|
+
// https://eslint-react.xyz/docs/rules/no-nested-component-definitions
|
|
141
151
|
'@eslint-react/no-nested-component-definitions': 'error',
|
|
142
152
|
|
|
143
153
|
// Prevent creating lazy components inside components
|
|
154
|
+
// https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
144
155
|
'@eslint-react/no-nested-lazy-component-declarations': 'error',
|
|
145
156
|
|
|
146
157
|
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
|
|
158
|
+
// https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
147
159
|
'@eslint-react/no-redundant-should-component-update': 'error',
|
|
148
160
|
|
|
149
161
|
// Prevent usage of setState in componentDidMount
|
|
162
|
+
// https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
150
163
|
'@eslint-react/no-set-state-in-component-did-mount': 'error',
|
|
151
164
|
|
|
152
165
|
// Prevent usage of setState in componentDidUpdate
|
|
166
|
+
// https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-update
|
|
153
167
|
'@eslint-react/no-set-state-in-component-did-update': 'error',
|
|
154
168
|
|
|
155
169
|
// Prevent usage of setState in componentWillUpdate
|
|
170
|
+
// https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
156
171
|
'@eslint-react/no-set-state-in-component-will-update': 'error',
|
|
157
172
|
|
|
158
173
|
// Disallow unnecessary useCallback hooks
|
|
174
|
+
// https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
159
175
|
'@eslint-react/no-unnecessary-use-callback': 'error',
|
|
160
176
|
|
|
161
177
|
// Disallow unnecessary useMemo hooks
|
|
178
|
+
// https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
162
179
|
'@eslint-react/no-unnecessary-use-memo': 'error',
|
|
163
180
|
|
|
164
181
|
// Disallow unnecessary "use" prefix on custom hooks
|
|
182
|
+
// https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
165
183
|
'@eslint-react/no-unnecessary-use-prefix': 'error',
|
|
166
184
|
|
|
167
185
|
// Disallow usage of UNSAFE_componentWillMount
|
|
186
|
+
// https://eslint-react.xyz/docs/rules/no-unsafe-component-will-mount
|
|
168
187
|
'@eslint-react/no-unsafe-component-will-mount': 'error',
|
|
169
188
|
|
|
170
189
|
// Disallow usage of UNSAFE_componentWillReceiveProps
|
|
190
|
+
// https://eslint-react.xyz/docs/rules/no-unsafe-component-will-receive-props
|
|
171
191
|
'@eslint-react/no-unsafe-component-will-receive-props': 'error',
|
|
172
192
|
|
|
173
193
|
// Disallow usage of UNSAFE_componentWillUpdate
|
|
194
|
+
// https://eslint-react.xyz/docs/rules/no-unsafe-component-will-update
|
|
174
195
|
'@eslint-react/no-unsafe-component-will-update': 'error',
|
|
175
196
|
|
|
176
197
|
// Prevent non-stable values used as context values
|
|
198
|
+
// https://eslint-react.xyz/docs/rules/no-unstable-context-value
|
|
177
199
|
'@eslint-react/no-unstable-context-value': 'error',
|
|
178
200
|
|
|
179
201
|
// Disallow referential-type variables as default props
|
|
202
|
+
// https://eslint-react.xyz/docs/rules/no-unstable-default-props
|
|
180
203
|
'@eslint-react/no-unstable-default-props': 'error',
|
|
181
204
|
|
|
182
205
|
// Prevent declaring unused methods of component class
|
|
206
|
+
// https://eslint-react.xyz/docs/rules/no-unused-class-component-members
|
|
183
207
|
'@eslint-react/no-unused-class-component-members': 'error',
|
|
184
208
|
|
|
185
209
|
// Warn about component props that are defined but never used
|
|
210
|
+
// https://eslint-react.xyz/docs/rules/no-unused-props
|
|
186
211
|
'@eslint-react/no-unused-props': 'error',
|
|
187
212
|
|
|
188
213
|
// Prevent unused state values
|
|
214
|
+
// https://eslint-react.xyz/docs/rules/no-unused-state
|
|
189
215
|
'@eslint-react/no-unused-state': 'error',
|
|
190
216
|
|
|
191
217
|
// Prefer using use() over useContext() (React 19+)
|
|
218
|
+
// https://eslint-react.xyz/docs/rules/no-use-context
|
|
192
219
|
'@eslint-react/no-use-context': 'error',
|
|
193
220
|
|
|
194
|
-
// Disallow unnecessary fragments
|
|
195
|
-
'@eslint-react/no-useless-fragment': 'error',
|
|
196
|
-
|
|
197
221
|
// Enforce consistent usage of destructuring assignment of props, state, and context
|
|
222
|
+
// https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
198
223
|
// decision: best left up to the implementer
|
|
199
224
|
'@eslint-react/prefer-destructuring-assignment': 'off',
|
|
200
225
|
|
|
201
226
|
// Enforce importing React via a namespace import
|
|
227
|
+
// https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
202
228
|
'@eslint-react/prefer-namespace-import': 'off',
|
|
203
229
|
|
|
204
230
|
// Validates that components/hooks are pure
|
|
231
|
+
// https://eslint-react.xyz/docs/rules/purity
|
|
205
232
|
'@eslint-react/purity': 'error',
|
|
206
233
|
|
|
207
234
|
// Validates correct usage of refs, not reading/writing during render
|
|
235
|
+
// https://eslint-react.xyz/docs/rules/refs
|
|
208
236
|
'@eslint-react/refs': 'error',
|
|
209
237
|
|
|
210
238
|
// Enforce Rules of Hooks
|
|
239
|
+
// https://eslint-react.xyz/docs/rules/rules-of-hooks
|
|
211
240
|
'@eslint-react/rules-of-hooks': 'error',
|
|
212
241
|
|
|
213
242
|
// Validates against calling setState synchronously in an effect
|
|
243
|
+
// https://eslint-react.xyz/docs/rules/set-state-in-effect
|
|
214
244
|
'@eslint-react/set-state-in-effect': 'error',
|
|
215
245
|
|
|
216
246
|
// Validates against setting state during render
|
|
247
|
+
// https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
217
248
|
'@eslint-react/set-state-in-render': 'error',
|
|
218
249
|
|
|
219
|
-
// Enforces the Rules of Props (unstable)
|
|
220
|
-
'@eslint-react/unstable-rules-of-props': 'error',
|
|
221
|
-
|
|
222
|
-
// Enforces the Rules of State (unstable)
|
|
223
|
-
'@eslint-react/unstable-rules-of-state': 'error',
|
|
224
|
-
|
|
225
250
|
// Validates against syntax that React does not support
|
|
251
|
+
// https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
226
252
|
'@eslint-react/unsupported-syntax': 'error',
|
|
227
253
|
|
|
228
254
|
// Validates usage of useMemo with a return value
|
|
255
|
+
// https://eslint-react.xyz/docs/rules/use-memo
|
|
229
256
|
'@eslint-react/use-memo': 'error',
|
|
230
257
|
|
|
231
258
|
// Ensure destructuring and symmetric naming of useState hook value and setter
|
|
259
|
+
// https://eslint-react.xyz/docs/rules/use-state
|
|
232
260
|
'@eslint-react/use-state': 'error',
|
|
233
261
|
|
|
262
|
+
// --- JSX rules ---
|
|
263
|
+
|
|
264
|
+
// Prevent passing of children as props
|
|
265
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-children-prop
|
|
266
|
+
'@eslint-react/jsx-no-children-prop': 'error',
|
|
267
|
+
|
|
268
|
+
// Prevent passing both children prop and JSX children simultaneously
|
|
269
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-children-prop-with-children
|
|
270
|
+
'@eslint-react/jsx-no-children-prop-with-children': 'error',
|
|
271
|
+
|
|
272
|
+
// Prevent accidental JS comments from being injected into JSX as text
|
|
273
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-comment-textnodes
|
|
274
|
+
'@eslint-react/jsx-no-comment-textnodes': 'error',
|
|
275
|
+
|
|
276
|
+
// Enforce key prop comes before spread to avoid overriding
|
|
277
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-key-after-spread
|
|
278
|
+
'@eslint-react/jsx-no-key-after-spread': 'error',
|
|
279
|
+
|
|
280
|
+
// Prevents unintentional leaked '$' sign before expression in JSX
|
|
281
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-leaked-dollar
|
|
282
|
+
'@eslint-react/jsx-no-leaked-dollar': 'error',
|
|
283
|
+
|
|
284
|
+
// Prevents unintentional leaked ';' in JSX
|
|
285
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-leaked-semicolon
|
|
286
|
+
'@eslint-react/jsx-no-leaked-semicolon': 'error',
|
|
287
|
+
|
|
288
|
+
// Enforce that namespaces are not used in JSX elements
|
|
289
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-namespace
|
|
290
|
+
'@eslint-react/jsx-no-namespace': 'error',
|
|
291
|
+
|
|
292
|
+
// Disallow unnecessary fragments
|
|
293
|
+
// https://eslint-react.xyz/docs/rules/jsx-no-useless-fragment
|
|
294
|
+
'@eslint-react/jsx-no-useless-fragment': 'error',
|
|
295
|
+
|
|
234
296
|
// --- React DOM rules ---
|
|
235
297
|
|
|
236
298
|
// Warn on usage of dangerouslySetInnerHTML
|
|
237
|
-
|
|
299
|
+
// https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml
|
|
300
|
+
'@eslint-react/dom-no-dangerously-set-innerhtml': 'error',
|
|
238
301
|
|
|
239
302
|
// Prevent problem with children and dangerouslySetInnerHTML
|
|
240
|
-
|
|
303
|
+
// https://eslint-react.xyz/docs/rules/dom-no-dangerously-set-innerhtml-with-children
|
|
304
|
+
'@eslint-react/dom-no-dangerously-set-innerhtml-with-children': 'error',
|
|
241
305
|
|
|
242
306
|
// Warn against using findDOMNode()
|
|
243
|
-
|
|
307
|
+
// https://eslint-react.xyz/docs/rules/dom-no-find-dom-node
|
|
308
|
+
'@eslint-react/dom-no-find-dom-node': 'error',
|
|
244
309
|
|
|
245
310
|
// Disallow usage of flushSync
|
|
246
|
-
|
|
311
|
+
// https://eslint-react.xyz/docs/rules/dom-no-flush-sync
|
|
312
|
+
'@eslint-react/dom-no-flush-sync': 'error',
|
|
247
313
|
|
|
248
314
|
// Disallow usage of ReactDOM.hydrate (use hydrateRoot instead)
|
|
249
|
-
|
|
315
|
+
// https://eslint-react.xyz/docs/rules/dom-no-hydrate
|
|
316
|
+
'@eslint-react/dom-no-hydrate': 'error',
|
|
250
317
|
|
|
251
318
|
// Enforce that buttons have an explicit type attribute
|
|
252
|
-
|
|
319
|
+
// https://eslint-react.xyz/docs/rules/dom-no-missing-button-type
|
|
320
|
+
'@eslint-react/dom-no-missing-button-type': 'error',
|
|
253
321
|
|
|
254
322
|
// Enforce sandbox attribute on iframe elements
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
// Enforce that namespaces are not used in React elements
|
|
258
|
-
'@eslint-react/dom/no-namespace': 'error',
|
|
323
|
+
// https://eslint-react.xyz/docs/rules/dom-no-missing-iframe-sandbox
|
|
324
|
+
'@eslint-react/dom-no-missing-iframe-sandbox': 'error',
|
|
259
325
|
|
|
260
326
|
// Disallow usage of ReactDOM.render (use createRoot instead)
|
|
261
|
-
|
|
327
|
+
// https://eslint-react.xyz/docs/rules/dom-no-render
|
|
328
|
+
'@eslint-react/dom-no-render': 'error',
|
|
262
329
|
|
|
263
330
|
// Disallow using ReactDOM.render return value
|
|
264
|
-
|
|
331
|
+
// https://eslint-react.xyz/docs/rules/dom-no-render-return-value
|
|
332
|
+
'@eslint-react/dom-no-render-return-value': 'error',
|
|
265
333
|
|
|
266
334
|
// Prevent usage of javascript: URLs
|
|
267
|
-
|
|
335
|
+
// https://eslint-react.xyz/docs/rules/dom-no-script-url
|
|
336
|
+
'@eslint-react/dom-no-script-url': 'error',
|
|
268
337
|
|
|
269
338
|
// Require style prop value be an object
|
|
270
|
-
|
|
339
|
+
// https://eslint-react.xyz/docs/rules/dom-no-string-style-prop
|
|
340
|
+
'@eslint-react/dom-no-string-style-prop': 'error',
|
|
271
341
|
|
|
272
342
|
// Prevent usage of unknown DOM property
|
|
273
|
-
|
|
343
|
+
// https://eslint-react.xyz/docs/rules/dom-no-unknown-property
|
|
344
|
+
'@eslint-react/dom-no-unknown-property': 'error',
|
|
274
345
|
|
|
275
346
|
// Enforce safe iframe sandbox attribute values
|
|
276
|
-
|
|
347
|
+
// https://eslint-react.xyz/docs/rules/dom-no-unsafe-iframe-sandbox
|
|
348
|
+
'@eslint-react/dom-no-unsafe-iframe-sandbox': 'error',
|
|
277
349
|
|
|
278
350
|
// Disallow target="_blank" without rel="noreferrer"
|
|
279
|
-
|
|
351
|
+
// https://eslint-react.xyz/docs/rules/dom-no-unsafe-target-blank
|
|
352
|
+
'@eslint-react/dom-no-unsafe-target-blank': 'error',
|
|
280
353
|
|
|
281
354
|
// Disallow usage of deprecated useFormState (use useActionState instead)
|
|
282
|
-
|
|
355
|
+
// https://eslint-react.xyz/docs/rules/dom-no-use-form-state
|
|
356
|
+
'@eslint-react/dom-no-use-form-state': 'error',
|
|
283
357
|
|
|
284
358
|
// Prevent void DOM elements from receiving children
|
|
285
|
-
|
|
359
|
+
// https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
|
|
360
|
+
'@eslint-react/dom-no-void-elements-with-children': 'error',
|
|
286
361
|
|
|
287
362
|
// Enforce importing React DOM via a namespace import
|
|
288
|
-
|
|
363
|
+
// https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
|
|
364
|
+
'@eslint-react/dom-prefer-namespace-import': 'off',
|
|
289
365
|
|
|
290
366
|
// --- RSC rules ---
|
|
291
367
|
|
|
292
368
|
// Enforce correct function definition for React Server Components
|
|
293
|
-
|
|
369
|
+
// https://eslint-react.xyz/docs/rules/rsc-function-definition
|
|
370
|
+
'@eslint-react/rsc-function-definition': 'error',
|
|
294
371
|
|
|
295
372
|
// --- Naming convention rules ---
|
|
296
373
|
|
|
297
374
|
// Enforce consistent naming for React context
|
|
298
|
-
|
|
375
|
+
// https://eslint-react.xyz/docs/rules/naming-convention-context-name
|
|
376
|
+
'@eslint-react/naming-convention-context-name': 'error',
|
|
299
377
|
|
|
300
378
|
// Enforce consistent naming for React component identifiers
|
|
301
|
-
|
|
379
|
+
// https://eslint-react.xyz/docs/rules/naming-convention-id-name
|
|
380
|
+
'@eslint-react/naming-convention-id-name': 'error',
|
|
302
381
|
|
|
303
382
|
// Enforce consistent naming for refs
|
|
304
|
-
|
|
383
|
+
// https://eslint-react.xyz/docs/rules/naming-convention-ref-name
|
|
384
|
+
'@eslint-react/naming-convention-ref-name': 'error',
|
|
305
385
|
|
|
306
386
|
// --- Web API rules ---
|
|
307
387
|
|
|
308
388
|
// Prevent leaked event listeners
|
|
309
|
-
|
|
389
|
+
// https://eslint-react.xyz/docs/rules/web-api-no-leaked-event-listener
|
|
390
|
+
'@eslint-react/web-api-no-leaked-event-listener': 'error',
|
|
310
391
|
|
|
311
392
|
// Prevent leaked setInterval calls
|
|
312
|
-
|
|
393
|
+
// https://eslint-react.xyz/docs/rules/web-api-no-leaked-interval
|
|
394
|
+
'@eslint-react/web-api-no-leaked-interval': 'error',
|
|
313
395
|
|
|
314
396
|
// Prevent leaked ResizeObserver instances
|
|
315
|
-
|
|
397
|
+
// https://eslint-react.xyz/docs/rules/web-api-no-leaked-resize-observer
|
|
398
|
+
'@eslint-react/web-api-no-leaked-resize-observer': 'error',
|
|
316
399
|
|
|
317
400
|
// Prevent leaked setTimeout calls
|
|
318
|
-
|
|
401
|
+
// https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
402
|
+
'@eslint-react/web-api-no-leaked-timeout': 'error',
|
|
319
403
|
};
|
package/src/rules/typescript.mjs
CHANGED
|
@@ -32,7 +32,9 @@ export default {
|
|
|
32
32
|
// decision: prefer @typescript-eslint/no-implied-eval
|
|
33
33
|
'no-implied-eval': 'off',
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// Disallow this keywords outside of classes or class-like objects
|
|
36
|
+
// https://typescript-eslint.io/rules/no-invalid-this
|
|
37
|
+
// decision: superceded by noImplicitThis in tsconfig
|
|
36
38
|
'no-invalid-this': 'off',
|
|
37
39
|
|
|
38
40
|
// decision: prefer @typescript-eslint/no-loop-func
|
|
@@ -523,7 +525,9 @@ export default {
|
|
|
523
525
|
|
|
524
526
|
// Enforce non-null assertions over explicit type casts
|
|
525
527
|
// https://typescript-eslint.io/rules/non-nullable-type-assertion-style
|
|
526
|
-
|
|
528
|
+
// decision: disabled because it conflicts with `no-non-null-assertion` — this rule's autofix
|
|
529
|
+
// rewrites `value as T` to `value!`, which `no-non-null-assertion` then rejects
|
|
530
|
+
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
|
527
531
|
|
|
528
532
|
// Disallow throwing non-Error values as exceptions
|
|
529
533
|
// https://typescript-eslint.io/rules/only-throw-error
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"undefined": false,
|
|
65
65
|
"unescape": false,
|
|
66
66
|
},
|
|
67
|
-
"parser": "typescript-eslint/parser@8.
|
|
67
|
+
"parser": "typescript-eslint/parser@8.58.0",
|
|
68
68
|
"parserOptions": {
|
|
69
69
|
"requireConfigFile": false,
|
|
70
70
|
},
|
|
@@ -1177,7 +1177,7 @@
|
|
|
1177
1177
|
0,
|
|
1178
1178
|
],
|
|
1179
1179
|
"no-dupe-args": [
|
|
1180
|
-
|
|
1180
|
+
0,
|
|
1181
1181
|
],
|
|
1182
1182
|
"no-dupe-class-members": [
|
|
1183
1183
|
2,
|
|
@@ -1400,10 +1400,10 @@
|
|
|
1400
1400
|
2,
|
|
1401
1401
|
],
|
|
1402
1402
|
"no-octal": [
|
|
1403
|
-
|
|
1403
|
+
0,
|
|
1404
1404
|
],
|
|
1405
1405
|
"no-octal-escape": [
|
|
1406
|
-
|
|
1406
|
+
0,
|
|
1407
1407
|
],
|
|
1408
1408
|
"no-param-reassign": [
|
|
1409
1409
|
2,
|