@wistia/eslint-config 2.6.0 → 2.8.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/workflows/release.yml +12 -1
- package/.yarn/releases/{yarn-4.13.0.cjs → yarn-4.14.1.cjs} +288 -288
- package/.yarnrc.yml +7 -2
- package/CHANGELOG.md +12 -0
- package/package.json +15 -19
- package/src/rules/react.mjs +12 -29
- package/test/__snapshots__/javascript.mjs.snap +1 -1
- package/test/__snapshots__/react.mjs.snap +10 -22
- package/test/__snapshots__/typescript.mjs.snap +2 -2
- package/test/__snapshots__/vitest.mjs.snap +1 -1
- package/src/configs/react-ssr-compatibility.mjs +0 -18
- package/src/rules/react-ssr-compatibility.mjs +0 -35
package/.yarnrc.yml
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
approvedGitRepositories:
|
|
2
|
+
- "**"
|
|
3
|
+
|
|
1
4
|
enableGlobalCache: false
|
|
2
5
|
|
|
6
|
+
enableScripts: true
|
|
7
|
+
|
|
3
8
|
nodeLinker: node-modules
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
npmMinimalAgeGate: 7d
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
yarnPath: .yarn/releases/yarn-4.14.1.cjs
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @wistia/eslint-config
|
|
2
2
|
|
|
3
|
+
## 2.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#488](https://github.com/wistia/eslint-config/pull/488) [`4f64acf`](https://github.com/wistia/eslint-config/commit/4f64acfdfd01afce6e3cb28759eed217d83a5e7b) Thanks [@okize](https://github.com/okize)! - feat: update react rules for new @eslint-react/eslint-plugin version
|
|
8
|
+
|
|
9
|
+
## 2.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#468](https://github.com/wistia/eslint-config/pull/468) [`9d23cc3`](https://github.com/wistia/eslint-config/commit/9d23cc3dbcdeea1454e5a13d851313f1106dc11c) Thanks [@okize](https://github.com/okize)! - feat: remove `react-ssr-compatibility` config & rules
|
|
14
|
+
|
|
3
15
|
## 2.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/eslint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "Wistia's ESLint configurations",
|
|
5
|
-
"packageManager": "yarn@4.
|
|
5
|
+
"packageManager": "yarn@4.14.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.mjs",
|
|
8
8
|
"engines": {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"./node": "./src/configs/node.mjs",
|
|
17
17
|
"./playwright": "./src/configs/playwright.mjs",
|
|
18
18
|
"./react": "./src/configs/react.mjs",
|
|
19
|
-
"./react-ssr-compatibility": "./src/configs/react-ssr-compatibility.mjs",
|
|
20
19
|
"./storybook": "./src/configs/storybook.mjs",
|
|
21
20
|
"./styled-components": "./src/configs/styled-components.mjs",
|
|
22
21
|
"./testing-library": "./src/configs/testing-library.mjs",
|
|
@@ -39,13 +38,13 @@
|
|
|
39
38
|
"test:export": "check-export-map"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@eslint-react/eslint-plugin": "^
|
|
41
|
+
"@eslint-react/eslint-plugin": "^5.7.3",
|
|
43
42
|
"@eslint/compat": "^2.0.5",
|
|
44
43
|
"@eslint/js": "^10.0.1",
|
|
45
44
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
47
|
-
"@typescript-eslint/parser": "^8.
|
|
48
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
46
|
+
"@typescript-eslint/parser": "^8.59.0",
|
|
47
|
+
"@vitest/eslint-plugin": "^1.6.16",
|
|
49
48
|
"confusing-browser-globals": "^1.0.11",
|
|
50
49
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
51
50
|
"eslint-plugin-barrel-files": "^3.0.1",
|
|
@@ -57,31 +56,28 @@
|
|
|
57
56
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
58
57
|
"eslint-plugin-n": "^17.24.0",
|
|
59
58
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
60
|
-
"eslint-plugin-
|
|
61
|
-
"eslint-plugin-playwright": "^2.10.1",
|
|
59
|
+
"eslint-plugin-playwright": "^2.10.2",
|
|
62
60
|
"eslint-plugin-prettier": "^5.5.5",
|
|
63
61
|
"eslint-plugin-promise": "^7.2.1",
|
|
64
|
-
"eslint-plugin-react-hooks-ssr": "^0.1.5",
|
|
65
|
-
"eslint-plugin-ssr-friendly": "^1.3.0",
|
|
66
62
|
"eslint-plugin-storybook": "^10.3.5",
|
|
67
63
|
"eslint-plugin-styled-components-a11y": "^2.2.1",
|
|
68
64
|
"eslint-plugin-testing-library": "^7.16.2",
|
|
69
65
|
"globals": "^17.5.0",
|
|
70
|
-
"globals-vitest": "^4.1.
|
|
66
|
+
"globals-vitest": "^4.1.5"
|
|
71
67
|
},
|
|
72
68
|
"devDependencies": {
|
|
73
69
|
"@changesets/changelog-github": "^0.6.0",
|
|
74
|
-
"@changesets/cli": "^2.
|
|
75
|
-
"@commitlint/cli": "^
|
|
76
|
-
"@commitlint/config-conventional": "^
|
|
70
|
+
"@changesets/cli": "^2.31.0",
|
|
71
|
+
"@commitlint/cli": "^21.0.1",
|
|
72
|
+
"@commitlint/config-conventional": "^21.0.1",
|
|
77
73
|
"check-export-map": "^1.3.1",
|
|
78
|
-
"eslint": "^10.2.
|
|
74
|
+
"eslint": "^10.2.1",
|
|
79
75
|
"glob": "^13.0.6",
|
|
80
76
|
"husky": "^9.1.7",
|
|
81
|
-
"prettier": "^3.8.
|
|
77
|
+
"prettier": "^3.8.3",
|
|
82
78
|
"storybook": "^10.3.5",
|
|
83
|
-
"typescript": "^6.0.
|
|
84
|
-
"vitest": "^4.1.
|
|
79
|
+
"typescript": "^6.0.3",
|
|
80
|
+
"vitest": "^4.1.5"
|
|
85
81
|
},
|
|
86
82
|
"peerDependencies": {
|
|
87
83
|
"eslint": ">= 10",
|
package/src/rules/react.mjs
CHANGED
|
@@ -30,14 +30,14 @@ export default {
|
|
|
30
30
|
|
|
31
31
|
// --- Core React rules ---
|
|
32
32
|
|
|
33
|
-
// Validates higher order functions defining nested components or hooks
|
|
34
|
-
// https://eslint-react.xyz/docs/rules/component-hook-factories
|
|
35
|
-
'@eslint-react/component-hook-factories': 'error',
|
|
36
|
-
|
|
37
33
|
// Validates usage of Error Boundaries instead of try/catch for child errors
|
|
38
34
|
// https://eslint-react.xyz/docs/rules/error-boundaries
|
|
39
35
|
'@eslint-react/error-boundaries': 'error',
|
|
40
36
|
|
|
37
|
+
// Restricts usage of global variables in React components
|
|
38
|
+
// https://eslint-react.xyz/docs/rules/globals
|
|
39
|
+
'@eslint-react/globals': 'error',
|
|
40
|
+
|
|
41
41
|
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
42
42
|
// https://eslint-react.xyz/docs/rules/exhaustive-deps
|
|
43
43
|
'@eslint-react/exhaustive-deps': 'error',
|
|
@@ -154,10 +154,6 @@ export default {
|
|
|
154
154
|
// https://eslint-react.xyz/docs/rules/no-nested-lazy-component-declarations
|
|
155
155
|
'@eslint-react/no-nested-lazy-component-declarations': 'error',
|
|
156
156
|
|
|
157
|
-
// Prevent usage of shouldComponentUpdate when extending React.PureComponent
|
|
158
|
-
// https://eslint-react.xyz/docs/rules/no-redundant-should-component-update
|
|
159
|
-
'@eslint-react/no-redundant-should-component-update': 'error',
|
|
160
|
-
|
|
161
157
|
// Prevent usage of setState in componentDidMount
|
|
162
158
|
// https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount
|
|
163
159
|
'@eslint-react/no-set-state-in-component-did-mount': 'error',
|
|
@@ -170,14 +166,6 @@ export default {
|
|
|
170
166
|
// https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update
|
|
171
167
|
'@eslint-react/no-set-state-in-component-will-update': 'error',
|
|
172
168
|
|
|
173
|
-
// Disallow unnecessary useCallback hooks
|
|
174
|
-
// https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback
|
|
175
|
-
'@eslint-react/no-unnecessary-use-callback': 'error',
|
|
176
|
-
|
|
177
|
-
// Disallow unnecessary useMemo hooks
|
|
178
|
-
// https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo
|
|
179
|
-
'@eslint-react/no-unnecessary-use-memo': 'error',
|
|
180
|
-
|
|
181
169
|
// Disallow unnecessary "use" prefix on custom hooks
|
|
182
170
|
// https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix
|
|
183
171
|
'@eslint-react/no-unnecessary-use-prefix': 'error',
|
|
@@ -218,15 +206,6 @@ export default {
|
|
|
218
206
|
// https://eslint-react.xyz/docs/rules/no-use-context
|
|
219
207
|
'@eslint-react/no-use-context': 'error',
|
|
220
208
|
|
|
221
|
-
// Enforce consistent usage of destructuring assignment of props, state, and context
|
|
222
|
-
// https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment
|
|
223
|
-
// decision: best left up to the implementer
|
|
224
|
-
'@eslint-react/prefer-destructuring-assignment': 'off',
|
|
225
|
-
|
|
226
|
-
// Enforce importing React via a namespace import
|
|
227
|
-
// https://eslint-react.xyz/docs/rules/prefer-namespace-import
|
|
228
|
-
'@eslint-react/prefer-namespace-import': 'off',
|
|
229
|
-
|
|
230
209
|
// Validates that components/hooks are pure
|
|
231
210
|
// https://eslint-react.xyz/docs/rules/purity
|
|
232
211
|
'@eslint-react/purity': 'error',
|
|
@@ -247,6 +226,10 @@ export default {
|
|
|
247
226
|
// https://eslint-react.xyz/docs/rules/set-state-in-render
|
|
248
227
|
'@eslint-react/set-state-in-render': 'error',
|
|
249
228
|
|
|
229
|
+
// Enforces static component definitions
|
|
230
|
+
// https://eslint-react.xyz/docs/rules/static-components
|
|
231
|
+
'@eslint-react/static-components': 'error',
|
|
232
|
+
|
|
250
233
|
// Validates against syntax that React does not support
|
|
251
234
|
// https://eslint-react.xyz/docs/rules/unsupported-syntax
|
|
252
235
|
'@eslint-react/unsupported-syntax': 'error',
|
|
@@ -359,10 +342,6 @@ export default {
|
|
|
359
342
|
// https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children
|
|
360
343
|
'@eslint-react/dom-no-void-elements-with-children': 'error',
|
|
361
344
|
|
|
362
|
-
// Enforce importing React DOM via a namespace import
|
|
363
|
-
// https://eslint-react.xyz/docs/rules/dom-prefer-namespace-import
|
|
364
|
-
'@eslint-react/dom-prefer-namespace-import': 'off',
|
|
365
|
-
|
|
366
345
|
// --- RSC rules ---
|
|
367
346
|
|
|
368
347
|
// Enforce correct function definition for React Server Components
|
|
@@ -400,4 +379,8 @@ export default {
|
|
|
400
379
|
// Prevent leaked setTimeout calls
|
|
401
380
|
// https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
402
381
|
'@eslint-react/web-api-no-leaked-timeout': 'error',
|
|
382
|
+
|
|
383
|
+
// Prevent leaked fetch calls in effects
|
|
384
|
+
// https://eslint-react.xyz/docs/rules/web-api-no-leaked-fetch
|
|
385
|
+
'@eslint-react/web-api-no-leaked-fetch': 'error',
|
|
403
386
|
};
|
|
@@ -1193,13 +1193,10 @@
|
|
|
1193
1193
|
},
|
|
1194
1194
|
"plugins": [
|
|
1195
1195
|
"@",
|
|
1196
|
-
"@eslint-react:@eslint-react/eslint-plugin@
|
|
1196
|
+
"@eslint-react:@eslint-react/eslint-plugin@5.7.3",
|
|
1197
1197
|
"jsx-a11y:eslint-plugin-jsx-a11y@6.10.2",
|
|
1198
1198
|
],
|
|
1199
1199
|
"rules": {
|
|
1200
|
-
"@eslint-react/component-hook-factories": [
|
|
1201
|
-
2,
|
|
1202
|
-
],
|
|
1203
1200
|
"@eslint-react/dom-no-dangerously-set-innerhtml": [
|
|
1204
1201
|
2,
|
|
1205
1202
|
],
|
|
@@ -1248,15 +1245,15 @@
|
|
|
1248
1245
|
"@eslint-react/dom-no-void-elements-with-children": [
|
|
1249
1246
|
2,
|
|
1250
1247
|
],
|
|
1251
|
-
"@eslint-react/dom-prefer-namespace-import": [
|
|
1252
|
-
0,
|
|
1253
|
-
],
|
|
1254
1248
|
"@eslint-react/error-boundaries": [
|
|
1255
1249
|
2,
|
|
1256
1250
|
],
|
|
1257
1251
|
"@eslint-react/exhaustive-deps": [
|
|
1258
1252
|
2,
|
|
1259
1253
|
],
|
|
1254
|
+
"@eslint-react/globals": [
|
|
1255
|
+
2,
|
|
1256
|
+
],
|
|
1260
1257
|
"@eslint-react/immutability": [
|
|
1261
1258
|
2,
|
|
1262
1259
|
],
|
|
@@ -1378,9 +1375,6 @@
|
|
|
1378
1375
|
"@eslint-react/no-nested-lazy-component-declarations": [
|
|
1379
1376
|
2,
|
|
1380
1377
|
],
|
|
1381
|
-
"@eslint-react/no-redundant-should-component-update": [
|
|
1382
|
-
2,
|
|
1383
|
-
],
|
|
1384
1378
|
"@eslint-react/no-set-state-in-component-did-mount": [
|
|
1385
1379
|
2,
|
|
1386
1380
|
],
|
|
@@ -1390,12 +1384,6 @@
|
|
|
1390
1384
|
"@eslint-react/no-set-state-in-component-will-update": [
|
|
1391
1385
|
2,
|
|
1392
1386
|
],
|
|
1393
|
-
"@eslint-react/no-unnecessary-use-callback": [
|
|
1394
|
-
2,
|
|
1395
|
-
],
|
|
1396
|
-
"@eslint-react/no-unnecessary-use-memo": [
|
|
1397
|
-
2,
|
|
1398
|
-
],
|
|
1399
1387
|
"@eslint-react/no-unnecessary-use-prefix": [
|
|
1400
1388
|
2,
|
|
1401
1389
|
],
|
|
@@ -1426,12 +1414,6 @@
|
|
|
1426
1414
|
"@eslint-react/no-use-context": [
|
|
1427
1415
|
2,
|
|
1428
1416
|
],
|
|
1429
|
-
"@eslint-react/prefer-destructuring-assignment": [
|
|
1430
|
-
0,
|
|
1431
|
-
],
|
|
1432
|
-
"@eslint-react/prefer-namespace-import": [
|
|
1433
|
-
0,
|
|
1434
|
-
],
|
|
1435
1417
|
"@eslint-react/purity": [
|
|
1436
1418
|
2,
|
|
1437
1419
|
],
|
|
@@ -1450,6 +1432,9 @@
|
|
|
1450
1432
|
"@eslint-react/set-state-in-render": [
|
|
1451
1433
|
2,
|
|
1452
1434
|
],
|
|
1435
|
+
"@eslint-react/static-components": [
|
|
1436
|
+
2,
|
|
1437
|
+
],
|
|
1453
1438
|
"@eslint-react/unsupported-syntax": [
|
|
1454
1439
|
2,
|
|
1455
1440
|
],
|
|
@@ -1462,6 +1447,9 @@
|
|
|
1462
1447
|
"@eslint-react/web-api-no-leaked-event-listener": [
|
|
1463
1448
|
2,
|
|
1464
1449
|
],
|
|
1450
|
+
"@eslint-react/web-api-no-leaked-fetch": [
|
|
1451
|
+
2,
|
|
1452
|
+
],
|
|
1465
1453
|
"@eslint-react/web-api-no-leaked-interval": [
|
|
1466
1454
|
2,
|
|
1467
1455
|
],
|
|
@@ -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.59.0",
|
|
68
68
|
"parserOptions": {
|
|
69
69
|
"ecmaVersion": 2024,
|
|
70
70
|
"project": "./tsconfig.json",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"plugins": [
|
|
79
79
|
"@",
|
|
80
80
|
"@stylistic:@stylistic/eslint-plugin@5.10.0",
|
|
81
|
-
"@typescript-eslint:@typescript-eslint/eslint-plugin@8.
|
|
81
|
+
"@typescript-eslint:@typescript-eslint/eslint-plugin@8.59.0",
|
|
82
82
|
"barrel-files:eslint-plugin-barrel-files@3.0.1",
|
|
83
83
|
"filenames",
|
|
84
84
|
"import-x:eslint-plugin-import-x@4.16.2",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { fixupPluginRules } from '@eslint/compat';
|
|
2
|
-
import ssrFriendlyPlugin from 'eslint-plugin-ssr-friendly';
|
|
3
|
-
import reactHooksSSRPlugin from 'eslint-plugin-react-hooks-ssr';
|
|
4
|
-
import noTypeofWindowUndefinedPlugin from 'eslint-plugin-no-typeof-window-undefined';
|
|
5
|
-
import reactSSRCompatibilityRules from '../rules/react-ssr-compatibility.mjs';
|
|
6
|
-
|
|
7
|
-
export default [
|
|
8
|
-
{
|
|
9
|
-
plugins: {
|
|
10
|
-
'ssr-friendly': fixupPluginRules(ssrFriendlyPlugin),
|
|
11
|
-
'react-hooks-ssr': fixupPluginRules(reactHooksSSRPlugin),
|
|
12
|
-
'no-typeof-window-undefined': fixupPluginRules(noTypeofWindowUndefinedPlugin),
|
|
13
|
-
},
|
|
14
|
-
rules: {
|
|
15
|
-
...reactSSRCompatibilityRules,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
];
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// only add rules related to maintaining SSR compatibility
|
|
2
|
-
// see:
|
|
3
|
-
// - https://github.com/kopiro/eslint-plugin-ssr-friendly
|
|
4
|
-
// - https://github.com/correttojs/eslint-plugin-react-hooks-ssr
|
|
5
|
-
// - https://github.com/nirtamir2/eslint-plugin-no-typeof-window-undefined
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
// Disallow use of DOM globals in module and global scope, as this will break any import/require in a NodeJS environment.
|
|
9
|
-
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-module-scope
|
|
10
|
-
'ssr-friendly/no-dom-globals-in-module-scope': 'error',
|
|
11
|
-
|
|
12
|
-
// Disallow use of DOM globals in class constructors, as this will break SSR if you're instantiating this class as singleton or you're rendering this component.
|
|
13
|
-
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-constructor
|
|
14
|
-
'ssr-friendly/no-dom-globals-in-constructor': 'error',
|
|
15
|
-
|
|
16
|
-
// Disallow use of DOM globals in render() method of a React class-component, as this will break SSR if you're rendering this component.
|
|
17
|
-
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-react-cc-render
|
|
18
|
-
'ssr-friendly/no-dom-globals-in-react-cc-render': 'error',
|
|
19
|
-
|
|
20
|
-
// Disallow use of DOM globals in the render-cycle of a React FC, as this will break SSR if you're rendering this component.
|
|
21
|
-
// https://github.com/kopiro/eslint-plugin-ssr-friendly#no-dom-globals-in-react-fc
|
|
22
|
-
'ssr-friendly/no-dom-globals-in-react-fc': 'error',
|
|
23
|
-
|
|
24
|
-
// forbid DOM globals within react server side rendering
|
|
25
|
-
// a global within `useEffect` or custom hook is allowed
|
|
26
|
-
// a global within a function prefixed by `async` (eg. `asyncMyFunc`) is allowed
|
|
27
|
-
// a global within a `useState`, `useReducer` and `useMemo` callback is forbidden
|
|
28
|
-
// a global within a React `Component` is forbidden
|
|
29
|
-
'react-hooks-ssr/react-hooks-global-ssr': 'error',
|
|
30
|
-
|
|
31
|
-
// avoid checking for window since it is supported by Deno
|
|
32
|
-
// prefer `typeof document === "undefined"` instead
|
|
33
|
-
// https://github.com/nirtamir2/eslint-plugin-no-typeof-window-undefined#no-typeof-window-undefined
|
|
34
|
-
'no-typeof-window-undefined/no-typeof-window-undefined': 'error',
|
|
35
|
-
};
|