@wistia/eslint-config 2.7.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.
@@ -21,11 +21,22 @@ jobs:
21
21
  runs-on: ubuntu-22.04
22
22
  timeout-minutes: 5
23
23
  steps:
24
+ - name: Generate GitHub App token
25
+ id: app-token
26
+ uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
27
+ with:
28
+ client-id: ${{ secrets.ACTIONS_BOT_GH_APP_CLIENT_ID }}
29
+ private-key: ${{ secrets.ACTIONS_BOT_GH_APP_PRIVATE_KEY }}
30
+ owner: ${{ github.repository_owner }}
31
+ repositories: eslint-config
32
+
24
33
  - name: Check out Git repository
25
34
  uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26
35
  with:
36
+ persist-credentials: false
27
37
  # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
28
38
  fetch-depth: 0
39
+ token: ${{ steps.app-token.outputs.token }}
29
40
 
30
41
  - name: Install Node and npm packages
31
42
  uses: ./.github/actions/setup-node-env
@@ -46,5 +57,5 @@ jobs:
46
57
  title: "chore: release v${{env.NEW_PACKAGE_VERSION}}"
47
58
  commit: "chore: release v${{env.NEW_PACKAGE_VERSION}}"
48
59
  env:
49
- GITHUB_TOKEN: ${{ secrets.WISTIA_GITHUB_BOT_TOKEN }}
60
+ GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
50
61
  NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 2.7.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wistia/eslint-config",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Wistia's ESLint configurations",
5
5
  "packageManager": "yarn@4.14.1",
6
6
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  "test:export": "check-export-map"
39
39
  },
40
40
  "dependencies": {
41
- "@eslint-react/eslint-plugin": "^4.2.3",
41
+ "@eslint-react/eslint-plugin": "^5.7.3",
42
42
  "@eslint/compat": "^2.0.5",
43
43
  "@eslint/js": "^10.0.1",
44
44
  "@stylistic/eslint-plugin": "^5.10.0",
@@ -68,8 +68,8 @@
68
68
  "devDependencies": {
69
69
  "@changesets/changelog-github": "^0.6.0",
70
70
  "@changesets/cli": "^2.31.0",
71
- "@commitlint/cli": "^20.5.0",
72
- "@commitlint/config-conventional": "^20.5.0",
71
+ "@commitlint/cli": "^21.0.1",
72
+ "@commitlint/config-conventional": "^21.0.1",
73
73
  "check-export-map": "^1.3.1",
74
74
  "eslint": "^10.2.1",
75
75
  "glob": "^13.0.6",
@@ -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@4.2.3",
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
  ],