Skip to content

Commit

Permalink
fix(eslint-config): switch to new babel parser (#34020)
Browse files Browse the repository at this point in the history
Summary:
[`babel-eslint`](https://github.com/babel/babel-eslint) is deprecated now. We should use the new Babel parser.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Use new Babel parser instead of deprecated one

Pull Request resolved: #34020

Test Plan: Ensure lint is working as expected.

Reviewed By: cortinico

Differential Revision: D37239826

Pulled By: jacdebug

fbshipit-source-id: f5fa5d7f829d6d3ae5cffd855ed6c8542c7d46de
  • Loading branch information
Kerumen authored and facebook-github-bot committed Jun 22, 2022
1 parent 1999191 commit 97291bf
Show file tree
Hide file tree
Showing 8 changed files with 347 additions and 362 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-config-react-native-community/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
overrides: [
{
files: ['*.js'],
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
plugins: ['flowtype'],
rules: {
// Flow Plugin
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-config-react-native-community/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-native-community/eslint-config",
"version": "3.0.2",
"version": "3.0.3",
"description": "ESLint config for React Native",
"main": "index.js",
"license": "MIT",
Expand All @@ -11,10 +11,11 @@
},
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/eslint-config-react-native-community#readme",
"dependencies": {
"@babel/core": "^7.14.0",
"@babel/eslint-parser": "^7.18.2",
"@react-native-community/eslint-plugin": "^1.1.0",
"@typescript-eslint/eslint-plugin": "^5.15.0",
"@typescript-eslint/parser": "^5.15.0",
"babel-eslint": "^10.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-flowtype": "^8.0.0",
Expand Down
517 changes: 290 additions & 227 deletions packages/eslint-config-react-native-community/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
const ESLintTester = require('eslint').RuleTester;

ESLintTester.setDefaultConfig({
parser: require.resolve('babel-eslint'),
parser: require.resolve('@babel/eslint-parser'),
parserOptions: {
requireConfigFile: false,
ecmaVersion: 6,
sourceType: 'module',
},
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin-specs/__tests__/eslint-tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
const ESLintTester = require('eslint').RuleTester;

ESLintTester.setDefaultConfig({
parser: require.resolve('babel-eslint'),
parser: require.resolve('@babel/eslint-parser'),
parserOptions: {
requireConfigFile: false,
ecmaVersion: 6,
sourceType: 'module',
babelOptions: {
presets: [require.resolve('@babel/preset-flow')],
},
},
});

Expand Down
4 changes: 3 additions & 1 deletion packages/eslint-plugin-specs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
},
"dependencies": {
"@babel/core": "^7.14.0",
"@babel/eslint-parser": "^7.18.2",
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
"@babel/preset-flow": "^7.17.12",
"flow-parser": "^0.121.0",
"make-dir": "^2.1.0",
"pirates":"^4.0.1",
"pirates": "^4.0.1",
"react-native-codegen": "*",
"source-map-support": "0.5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion repo-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
},
"dependencies": {
"@babel/core": "^7.14.0",
"@babel/eslint-parser": "^7.18.2",
"@babel/generator": "^7.14.0",
"@babel/plugin-transform-regenerator": "^7.0.0",
"@react-native-community/eslint-plugin": "*",
"@react-native/eslint-plugin-specs": ">0.0.2",
"@reactions/component": "^2.0.2",
"async": "^3.2.2",
"babel-eslint": "^10.1.0",
"clang-format": "^1.2.4",
"connect": "^3.6.5",
"coveralls": "^3.1.1",
Expand Down
170 changes: 42 additions & 128 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 97291bf

Please sign in to comment.