feat(eslint-plugin-react-hooks): support ESLint 8.x (#22248)
Michaël De Boey committed
Sep 6, 2021 at 21:17 UTC
0c0d1ddae4be922f800705ae686fbb887184b38b
7 files changed
+116
-5
.eslintrc.js
+12
@@ -182,6 +182,18 @@ module.exports = {
182
'jsx-a11y/tabindex-no-positive': OFF,
183
},
184
},
185
+ {
186
+ files: ['packages/eslint-plugin-react-hooks/src/*.js'],
187
+ plugins: ['eslint-plugin'],
188
+ rules: {
189
+ 'eslint-plugin/prefer-object-rule': ERROR,
190
+ 'eslint-plugin/require-meta-fixable': [
191
+ ERROR,
192
+ {catchNoFixerButFixableProperty: true},
193
+ ],
194
+ 'eslint-plugin/require-meta-has-suggestions': ERROR,
195
+ },
196
+ },
197
{
198
files: [
199
'packages/react-native-renderer/**/*.js',
package.json
+1
@@ -53,6 +53,7 @@
53
"eslint-config-fbjs": "^3.1.1",
54
"eslint-config-prettier": "^6.9.0",
55
"eslint-plugin-babel": "^5.3.0",
56
+ "eslint-plugin-eslint-plugin": "^3.5.3",
57
"eslint-plugin-flowtype": "^2.25.0",
58
"eslint-plugin-jest": "^22.15.0",
59
"eslint-plugin-jsx-a11y": "^6.3.1",
packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js
+14
@@ -8146,4 +8146,18 @@ describe('react-hooks', () => {
8146
...testsTypescriptEslintParser.invalid,
8147
],
8148
});
8149
+
8150
+ new ESLintTester({
8151
+ parser: require.resolve('@typescript-eslint/parser-v5'),
8152
+ parserOptions,
8153
+ }).run('parser: @typescript-eslint/parser@^5.0.0-0', ReactHooksESLintRule, {
8154
+ valid: [
8155
+ ...testsTypescriptEslintParserV4.valid,
8156
+ ...testsTypescriptEslintParser.valid,
8157
+ ],
8158
+ invalid: [
8159
+ ...testsTypescriptEslintParserV4.invalid,
8160
+ ...testsTypescriptEslintParser.invalid,
8161
+ ],
8162
+ });
8163
});
packages/eslint-plugin-react-hooks/package.json
+3
-2
@@ -29,11 +29,12 @@
29
},
30
"homepage": "https://reactjs.org/",
31
"peerDependencies": {
32
- "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
32
+ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0"
33
},
34
"devDependencies": {
35
"@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0",
36
"@typescript-eslint/parser-v3": "npm:@typescript-eslint/parser@^3.10.0",
37
- "@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@^4.1.0"
37
+ "@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@^4.1.0",
38
+ "@typescript-eslint/parser-v5": "npm:@typescript-eslint/parser@^5.0.0-0"
39
}
40
}
packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js
+1
-1
@@ -15,11 +15,11 @@ export default {
15
docs: {
16
description:
17
'verifies the list of dependencies for Hooks like useEffect and similar',
18
- category: 'Best Practices',
18
recommended: true,
19
url: 'https://github.com/facebook/react/issues/14920',
20
},
21
fixable: 'code',
22
+ hasSuggestions: true,
23
schema: [
24
{
25
type: 'object',
packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
-1
@@ -109,7 +109,6 @@ export default {
109
type: 'problem',
110
docs: {
111
description: 'enforces the Rules of Hooks',
112
- category: 'Possible Errors',
112
recommended: true,
113
url: 'https://reactjs.org/docs/hooks-rules.html',
114
},
yarn.lock
+85
-1
@@ -2367,6 +2367,16 @@
2367
"@typescript-eslint/typescript-estree" "4.1.0"
2368
debug "^4.1.1"
2369
2370
+"@typescript-eslint/parser-v5@npm:@typescript-eslint/parser@^5.0.0-0":
2371
+ version "5.0.0-alpha.25"
2372
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.0.0-alpha.25.tgz#d966eb8b2cf97f0134a5589791017e0a720bb995"
2373
+ integrity sha512-e0Q2fWVXle8l9pCCV2K/pQrn0Wyp8nV/Gp8AbEUqP6xLfgrOxejzcERP9y5x1rnwrp7pPXZhticsNLjqljhh6w==
2374
+ dependencies:
2375
+ "@typescript-eslint/scope-manager" "5.0.0-alpha.25+faf2d1d2"
2376
+ "@typescript-eslint/types" "5.0.0-alpha.25+faf2d1d2"
2377
+ "@typescript-eslint/typescript-estree" "5.0.0-alpha.25+faf2d1d2"
2378
+ debug "^4.3.1"
2379
+
2380
"@typescript-eslint/scope-manager@4.1.0":
2381
version "4.1.0"
2382
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.1.0.tgz#9e389745ee9cfe12252ed1e9958808abd6b3a683"
@@ -2375,6 +2385,14 @@
2385
"@typescript-eslint/types" "4.1.0"
2386
"@typescript-eslint/visitor-keys" "4.1.0"
2387
2388
+"@typescript-eslint/scope-manager@5.0.0-alpha.25+faf2d1d2":
2389
+ version "5.0.0-alpha.25"
2390
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.0.0-alpha.25.tgz#eb90cb682f6a3a14ba9afc4bd7c1f66cf362e1b0"
2391
+ integrity sha512-tZumo5HziFbOI+unwQ7Xgimn4FHltg20TCxVCU2tl7YyFhiQl1WxnmhU7/1MUNWXzK9RA88MRKvUON1lgK1FLw==
2392
+ dependencies:
2393
+ "@typescript-eslint/types" "5.0.0-alpha.25+faf2d1d2"
2394
+ "@typescript-eslint/visitor-keys" "5.0.0-alpha.25+faf2d1d2"
2395
+
2396
"@typescript-eslint/types@3.10.1":
2397
version "3.10.1"
2398
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-3.10.1.tgz#1d7463fa7c32d8a23ab508a803ca2fe26e758727"
@@ -2385,6 +2403,11 @@
2403
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.1.0.tgz#edbd3fec346f34e13ce7aa176b03b497a32c496a"
2404
integrity sha512-rkBqWsO7m01XckP9R2YHVN8mySOKKY2cophGM8K5uDK89ArCgahItQYdbg/3n8xMxzu2elss+an1TphlUpDuJw==
2405
2406
+"@typescript-eslint/types@5.0.0-alpha.25+faf2d1d2":
2407
+ version "5.0.0-alpha.25"
2408
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.0.0-alpha.25.tgz#2c5aaaee8d41d08fbb91193cc6df482374700b2e"
2409
+ integrity sha512-M9PZ+m1vD+UaBt+9hJ1bXTA94s4fvY3fOQkwYxrtreqqdzaiNcW8F5GAO3dthzmS+6II+XAsWfCQzCoBvoiOrw==
2410
+
2411
"@typescript-eslint/typescript-estree@1.13.0":
2412
version "1.13.0"
2413
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e"
@@ -2434,6 +2457,19 @@
2457
semver "^7.3.2"
2458
tsutils "^3.17.1"
2459
2460
+"@typescript-eslint/typescript-estree@5.0.0-alpha.25+faf2d1d2":
2461
+ version "5.0.0-alpha.25"
2462
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.0.0-alpha.25.tgz#1e9ad3464c93fffb1b17d8cc3e2523ae6add930b"
2463
+ integrity sha512-EIEX4TSWGIBBi9DMZd8FZoI52Ua6hkHj2T8ah83BEBVMS9wCJDZyryuw0PHTesA2ZB5yiQbtNQrrODLJxz1hAw==
2464
+ dependencies:
2465
+ "@typescript-eslint/types" "5.0.0-alpha.25+faf2d1d2"
2466
+ "@typescript-eslint/visitor-keys" "5.0.0-alpha.25+faf2d1d2"
2467
+ debug "^4.3.1"
2468
+ globby "^11.0.3"
2469
+ is-glob "^4.0.1"
2470
+ semver "^7.3.5"
2471
+ tsutils "^3.21.0"
2472
+
2473
"@typescript-eslint/visitor-keys@3.10.1":
2474
version "3.10.1"
2475
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz#cd4274773e3eb63b2e870ac602274487ecd1e931"
@@ -2449,6 +2485,14 @@
2485
"@typescript-eslint/types" "4.1.0"
2486
eslint-visitor-keys "^2.0.0"
2487
2488
+"@typescript-eslint/visitor-keys@5.0.0-alpha.25+faf2d1d2":
2489
+ version "5.0.0-alpha.25"
2490
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.0.0-alpha.25.tgz#0b4a909d4020094e638dee1ff72e12d24783c94b"
2491
+ integrity sha512-vh5AIlr3wxkhFMreop5Y1Wi5Sc9oK03J8+SiyKMEEAqwWmk6e2ryHr1001oWRuK4e6d/CjVNa73omERCWcTXTg==
2492
+ dependencies:
2493
+ "@typescript-eslint/types" "5.0.0-alpha.25+faf2d1d2"
2494
+ eslint-visitor-keys "^3.0.0"
2495
+
2496
"@vercel/build-utils@2.5.1":
2497
version "2.5.1"
2498
resolved "https://registry.yarnpkg.com/@vercel/build-utils/-/build-utils-2.5.1.tgz#2f687c2d82464dd85e0ed8130bc01e5dac9b11a4"
@@ -5485,6 +5529,13 @@ debug@^3.1.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6:
5529
dependencies:
5530
ms "^2.1.1"
5531
5532
+debug@^4.3.1:
5533
+ version "4.3.2"
5534
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
5535
+ integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
5536
+ dependencies:
5537
+ ms "2.1.2"
5538
+
5539
debuglog@^1.0.1:
5540
version "1.0.1"
5541
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
@@ -6341,6 +6392,13 @@ eslint-plugin-babel@^5.3.0:
6392
dependencies:
6393
eslint-rule-composer "^0.3.0"
6394
6395
+eslint-plugin-eslint-plugin@^3.5.3:
6396
+ version "3.5.3"
6397
+ resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-3.5.3.tgz#6cac958e944b820962a4cf9e65cc32a2e0415eaf"
6398
+ integrity sha512-8LnYyjIOLS0gqh3QFVBkahYzkFd5UaMZkkeEvqReSjIBgajYyZaMElU8szHhqDrqr0rWkkZk33j9e4qnFN3x2A==
6399
+ dependencies:
6400
+ eslint-utils "^2.1.0"
6401
+
6402
eslint-plugin-flowtype@^2.25.0:
6403
version "2.50.3"
6404
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.50.3.tgz#61379d6dce1d010370acd6681740fd913d68175f"
@@ -6464,6 +6522,11 @@ eslint-visitor-keys@^2.0.0:
6522
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
6523
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
6524
6525
+eslint-visitor-keys@^3.0.0:
6526
+ version "3.0.0"
6527
+ resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186"
6528
+ integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==
6529
+
6530
eslint@5.16.0:
6531
version "5.16.0"
6532
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea"
@@ -10548,6 +10611,13 @@ lru-cache@^5.1.1:
10611
dependencies:
10612
yallist "^3.0.2"
10613
10614
+lru-cache@^6.0.0:
10615
+ version "6.0.0"
10616
+ resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
10617
+ integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
10618
+ dependencies:
10619
+ yallist "^4.0.0"
10620
+
10621
macos-release@^2.2.0:
10622
version "2.3.0"
10623
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f"
@@ -11049,7 +11119,7 @@ ms@2.1.1:
11119
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
11120
integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==
11121
11052
-ms@^2.0.0, ms@^2.1.1:
11122
+ms@2.1.2, ms@^2.0.0, ms@^2.1.1:
11123
version "2.1.2"
11124
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
11125
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
@@ -13841,6 +13911,13 @@ semver@^7.0.0, semver@^7.1.1:
13911
resolved "https://registry.yarnpkg.com/semver/-/semver-7.1.1.tgz#29104598a197d6cbe4733eeecbe968f7b43a9667"
13912
integrity sha512-WfuG+fl6eh3eZ2qAf6goB7nhiCd7NPXhmyFxigB/TOkQyeLP8w8GsVehvtGNtnNmyboz4TgeK40B1Kbql/8c5A==
13913
13914
+semver@^7.3.5:
13915
+ version "7.3.5"
13916
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
13917
+ integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
13918
+ dependencies:
13919
+ lru-cache "^6.0.0"
13920
+
13921
send@0.17.1:
13922
version "0.17.1"
13923
resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"
@@ -15215,6 +15292,13 @@ tsutils@^3.17.1:
15292
dependencies:
15293
tslib "^1.8.1"
15294
15295
+tsutils@^3.21.0:
15296
+ version "3.21.0"
15297
+ resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
15298
+ integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==
15299
+ dependencies:
15300
+ tslib "^1.8.1"
15301
+
15302
tty-browserify@0.0.0:
15303
version "0.0.0"
15304
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"