Skip to content

Commit f5467d5

Browse files
feat(eslint-config-react-app): support ESLint 8.x (#11375)
1 parent e8319da commit f5467d5

File tree

7 files changed

+1046
-1649
lines changed

7 files changed

+1046
-1649
lines changed

package-lock.json

+1,008-1,618
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@testing-library/react": "^11.1.0",
2626
"@testing-library/user-event": "^12.1.10",
2727
"alex": "^8.2.0",
28-
"eslint": "^7.30.0",
28+
"eslint": "^8.3.0",
2929
"execa": "^5.1.1",
3030
"fs-extra": "^9.0.1",
3131
"get-port": "^5.1.1",

packages/eslint-config-react-app/README.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ The easiest way to use this configuration is with [Create React App](https://git
1616

1717
If you want to use this ESLint configuration in a project not built with Create React App, you can install it with the following steps.
1818

19-
First, install this package, ESLint and the necessary plugins. Note that when using npm 7 (or greater) this step is not required, as npm will automatically install peer dependencies.
19+
First, install this package and ESLint.
2020

2121
```sh
22-
npm install --save-dev eslint-config-react-app @babel/eslint-parser@^7.14.7 @typescript-eslint/eslint-plugin@^4.0.0 @typescript-eslint/parser@^4.0.0 babel-preset-react-app@^10.0.0 eslint@^7.5.0 eslint-plugin-flowtype@^5.2.0 eslint-plugin-import@^2.22.0 eslint-plugin-jsx-a11y@^6.3.1 eslint-plugin-react@^7.20.3 eslint-plugin-react-hooks@^4.0.8
22+
npm install --save-dev eslint-config-react-app eslint@^8.0.0
2323
```
2424

2525
Then create a file named `.eslintrc.json` with following contents in the root folder of your project:
@@ -36,13 +36,7 @@ That's it! You can override the settings from `eslint-config-react-app` by editi
3636

3737
This config also ships with optional Jest rules for ESLint (based on [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest)).
3838

39-
You'll first need to add the ESLint plugin for Jest (if you don't already have it installed).
40-
41-
```sh
42-
npm install --save-dev eslint-plugin-jest@^24.0.0 eslint-plugin-testing-library@^3.9.0
43-
```
44-
45-
You can then enable these rules by adding the Jest config to the `extends` array in your ESLint config.
39+
You can enable these rules by adding the Jest config to the `extends` array in your ESLint config.
4640

4741
```json
4842
{

packages/eslint-config-react-app/jest.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,31 @@ module.exports = {
3131
'jest/no-jasmine-globals': 'error',
3232
'jest/no-jest-import': 'error',
3333
'jest/no-mocks-import': 'error',
34-
'jest/valid-describe': 'error',
34+
'jest/valid-describe-callback': 'error',
3535
'jest/valid-expect': 'error',
3636
'jest/valid-expect-in-promise': 'error',
3737
'jest/valid-title': 'warn',
3838

3939
// https://github.com/testing-library/eslint-plugin-testing-library
4040
'testing-library/await-async-query': 'error',
4141
'testing-library/await-async-utils': 'error',
42-
'testing-library/no-await-sync-query': 'warn',
42+
'testing-library/no-await-sync-query': 'error',
43+
'testing-library/no-container': 'error',
44+
'testing-library/no-debugging-utils': 'error',
4345
'testing-library/no-dom-import': ['error', 'react'],
46+
'testing-library/no-node-access': 'error',
47+
'testing-library/no-promise-in-fire-event': 'error',
48+
'testing-library/no-render-in-setup': 'error',
49+
'testing-library/no-unnecessary-act': 'error',
4450
'testing-library/no-wait-for-empty-callback': 'error',
51+
'testing-library/no-wait-for-multiple-assertions': 'error',
52+
'testing-library/no-wait-for-side-effects': 'error',
4553
'testing-library/no-wait-for-snapshot': 'error',
54+
'testing-library/prefer-find-by': 'error',
55+
'testing-library/prefer-presence-queries': 'error',
56+
'testing-library/prefer-query-by-disappearance': 'error',
57+
'testing-library/prefer-screen-queries': 'error',
58+
'testing-library/render-result-naming-convention': 'error',
4659
},
4760
},
4861
],

packages/eslint-config-react-app/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@
1717
"jest.js"
1818
],
1919
"peerDependencies": {
20-
"eslint": "^7.30.0"
20+
"eslint": "^8.0.0"
2121
},
2222
"dependencies": {
23-
"@babel/core": "^7.14.2",
24-
"@babel/eslint-parser": "^7.14.7",
25-
"@rushstack/eslint-patch": "^1.0.6",
26-
"@typescript-eslint/eslint-plugin": "^4.0.0",
27-
"@typescript-eslint/parser": "^4.0.0",
23+
"@babel/core": "^7.16.0",
24+
"@babel/eslint-parser": "^7.16.3",
25+
"@rushstack/eslint-patch": "^1.1.0",
26+
"@typescript-eslint/eslint-plugin": "^5.5.0",
27+
"@typescript-eslint/parser": "^5.5.0",
2828
"babel-preset-react-app": "^10.0.0",
2929
"confusing-browser-globals": "^1.0.10",
30-
"eslint-plugin-flowtype": "^5.2.0",
31-
"eslint-plugin-import": "^2.22.0",
32-
"eslint-plugin-jest": "^24.0.0",
33-
"eslint-plugin-jsx-a11y": "^6.3.1",
34-
"eslint-plugin-react": "^7.20.3",
35-
"eslint-plugin-react-hooks": "^4.0.8",
36-
"eslint-plugin-testing-library": "^3.9.0"
30+
"eslint-plugin-flowtype": "^8.0.3",
31+
"eslint-plugin-import": "^2.25.3",
32+
"eslint-plugin-jest": "^25.3.0",
33+
"eslint-plugin-jsx-a11y": "^6.5.1",
34+
"eslint-plugin-react": "^7.27.1",
35+
"eslint-plugin-react-hooks": "^4.3.0",
36+
"eslint-plugin-testing-library": "^5.0.1"
3737
},
3838
"engines": {
3939
"node": ">=14.0.0"

packages/react-error-overlay/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@
3535
"lib/index.js"
3636
],
3737
"devDependencies": {
38-
"@babel/code-frame": "^7.12.13",
39-
"@babel/core": "^7.14.2",
38+
"@babel/code-frame": "^7.16.0",
39+
"@babel/core": "^7.16.0",
4040
"anser": "^1.4.10",
4141
"babel-jest": "^27.1.0",
4242
"babel-loader": "^8.2.2",
4343
"babel-preset-react-app": "^10.0.0",
4444
"chalk": "^2.4.2",
4545
"chokidar": "^3.5.1",
4646
"cross-env": "^7.0.3",
47-
"eslint": "^7.30.0",
47+
"eslint": "^8.3.0",
4848
"eslint-config-react-app": "^6.0.0",
4949
"flow-bin": "^0.116.0",
5050
"html-entities": "^1.3.1",

packages/react-scripts/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"types": "./lib/react-app.d.ts",
3030
"dependencies": {
31-
"@babel/core": "^7.14.2",
31+
"@babel/core": "^7.16.0",
3232
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
3333
"@svgr/webpack": "^5.5.0",
3434
"babel-jest": "^27.1.0",
@@ -43,9 +43,9 @@
4343
"css-minimizer-webpack-plugin": "^3.0.2",
4444
"dotenv": "^9.0.2",
4545
"dotenv-expand": "^5.1.0",
46-
"eslint": "^7.30.0",
46+
"eslint": "^8.3.0",
4747
"eslint-config-react-app": "^6.0.0",
48-
"eslint-webpack-plugin": "^2.5.4",
48+
"eslint-webpack-plugin": "^3.1.1",
4949
"file-loader": "^6.2.0",
5050
"fs-extra": "^10.0.0",
5151
"html-webpack-plugin": "^5.3.2",

0 commit comments

Comments
 (0)