Skip to content

Commit

Permalink
Revert to @babel/eslint-parser in eslint-config
Browse files Browse the repository at this point in the history
Summary:
Motivated by facebook/hermes#1549. This was originally changed in facebook#46696, as our internal Flow support had diverged from `babel/eslint-parser` (facebook#46601).

We effectively have three flavours of JavaScript in support:
- Flow@latest for the `react-native` package, shipped as source — uses `hermes-parser`.
- TypeScript for product code (community template, Expo) — uses `babel/plugin-syntax-typescript`.
- Plain JavaScript or Flow in product code, *which may be extended with additional user Babel plugins and needs lenient parsing* — uses `babel/plugin-syntax-flow` via `babel/eslint-parser` (**this change**).

I'd love to simplify this 😅.

Switching to `hermes-eslint` for the RN monorepo codebase (D63541483) is unchanged.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D65272156
  • Loading branch information
huntie authored and facebook-github-bot committed Oct 31, 2024
1 parent 667ba76 commit 673bd02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/eslint-config-react-native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {
overrides: [
{
files: ['*.js'],
parser: 'hermes-eslint',
parser: '@babel/eslint-parser',
plugins: ['ft-flow'],
rules: {
// Flow Plugin
Expand All @@ -51,7 +51,7 @@ module.exports = {
},
{
files: ['*.jsx'],
parser: 'hermes-eslint',
parser: '@babel/eslint-parser',
},
{
files: ['*.ts', '*.tsx'],
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"main": "index.js",
"dependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@react-native/eslint-plugin": "0.77.0-main",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
Expand All @@ -30,8 +31,7 @@
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0",
"hermes-eslint": "0.24.0"
"eslint-plugin-react-native": "^4.0.0"
},
"peerDependencies": {
"eslint": ">=8",
Expand Down

0 comments on commit 673bd02

Please sign in to comment.