Skip to content

Commit bbd5a60

Browse files
JLHwungmrmckeb
andauthored
chore: migrate to @babel/eslint-parser (facebook#10761)
Co-authored-by: Brody McKee <[email protected]>
1 parent 369fccf commit bbd5a60

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

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

Lines changed: 2 additions & 2 deletions
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.
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.
2020

2121
```sh
22-
npm install --save-dev eslint-config-react-app @typescript-eslint/eslint-plugin@^4.0.0 @typescript-eslint/parser@^4.0.0 babel-eslint@^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 @babel/eslint-parser@^7.13.0 @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
2323
```
2424

2525
Then create a file named `.eslintrc.json` with following contents in the root folder of your project:

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
module.exports = {
1515
root: true,
1616

17-
parser: 'babel-eslint',
17+
parser: '@babel/eslint-parser',
1818

1919
plugins: ['react'],
2020

@@ -27,10 +27,10 @@ module.exports = {
2727
},
2828

2929
parserOptions: {
30-
ecmaVersion: 2018,
3130
sourceType: 'module',
32-
ecmaFeatures: {
33-
jsx: true,
31+
requireConfigFile: false,
32+
babelOptions: {
33+
presets: ['babel-preset-react-app/prod'],
3434
},
3535
},
3636

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
"jest.js"
1818
],
1919
"peerDependencies": {
20+
"@babel/eslint-parser": "^7.13.0",
2021
"@typescript-eslint/eslint-plugin": "^4.0.0",
2122
"@typescript-eslint/parser": "^4.0.0",
22-
"babel-eslint": "^10.0.0",
23+
"babel-preset-react-app": "^10.0.0",
2324
"eslint": "^7.5.0",
2425
"eslint-plugin-flowtype": "^5.2.0",
2526
"eslint-plugin-import": "^2.22.0",

packages/react-error-overlay/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"lib/index.js"
3535
],
3636
"devDependencies": {
37-
"@babel/code-frame": "^7.10.4",
38-
"@babel/core": "^7.12.3",
37+
"@babel/code-frame": "7.10.4",
38+
"@babel/core": "7.12.3",
39+
"@babel/eslint-parser": "^7.13.14",
3940
"anser": "1.4.10",
40-
"babel-eslint": "^10.1.0",
4141
"babel-jest": "^26.6.0",
4242
"babel-loader": "^8.1.0",
4343
"babel-preset-react-app": "^10.0.0",

packages/react-scripts/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
},
2929
"types": "./lib/react-app.d.ts",
3030
"dependencies": {
31-
"@babel/core": "^7.12.3",
31+
"@babel/core": "7.12.3",
32+
"@babel/eslint-parser": "^7.13.14",
3233
"@pmmmwh/react-refresh-webpack-plugin": "0.4.3",
3334
"@svgr/webpack": "5.5.0",
3435
"@typescript-eslint/eslint-plugin": "^4.5.0",
3536
"@typescript-eslint/parser": "^4.5.0",
36-
"babel-eslint": "^10.1.0",
3737
"babel-jest": "^26.6.0",
3838
"babel-loader": "^8.1.0",
3939
"babel-plugin-named-asset-import": "^0.3.7",

packages/react-scripts/scripts/build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ function build(previousFileSizes) {
194194
messages.warnings.length
195195
) {
196196
// Ignore sourcemap warnings in CI builds. See #8227 for more info.
197-
const filteredWarnings = messages.warnings.filter(w => !/Failed to parse source map/.test(w));
197+
const filteredWarnings = messages.warnings.filter(
198+
w => !/Failed to parse source map/.test(w)
199+
);
198200
if (filteredWarnings.length) {
199201
console.log(
200202
chalk.yellow(

packages/react-scripts/scripts/utils/verifyPackageTree.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function verifyPackageTree() {
2323
// These are packages most likely to break in practice.
2424
// See https://github.com/facebook/create-react-app/issues/1795 for reasons why.
2525
// I have not included Babel here because plugins typically don't import Babel (so it's not affected).
26+
'@babel/eslint-parser',
2627
'babel-jest',
2728
'babel-loader',
2829
'jest',

0 commit comments

Comments
 (0)