[eprh] Remove hermes-parser (#34719)
We will be focusing eslint-plugin-react-hooks as the primary OSS-only package for our lint plugin. eslint-plugin-react-compiler will remain as a Meta only package as some limitations of our internal infra require us to use packages that aren't widely adopted by the rest of the industry. This PR removes `hermes-parser`, which was meant to support parsing Flow syntax.
lauren committed
Oct 3, 2025 at 12:58 UTC
71753ac90a009ddefe2f7653165902d55edd1898
3 files changed
+12
-40
packages/eslint-plugin-react-hooks/package.json
+4
-5
@@ -41,7 +41,6 @@
41
"dependencies": {
42
"@babel/core": "^7.24.4",
43
"@babel/parser": "^7.24.4",
44
- "hermes-parser": "^0.25.1",
44
"zod": "^3.22.4",
45
"zod-validation-error": "^3.0.3"
46
},
@@ -50,14 +49,14 @@
49
"@babel/preset-typescript": "^7.26.0",
50
"@babel/types": "^7.19.0",
51
"@tsconfig/strictest": "^2.0.5",
53
- "@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0",
54
- "@typescript-eslint/parser-v3": "npm:@typescript-eslint/parser@^3.10.0",
55
- "@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@^4.1.0",
56
- "@typescript-eslint/parser-v5": "npm:@typescript-eslint/parser@^5.62.0",
52
"@types/eslint": "^8.56.12",
53
"@types/estree": "^1.0.6",
54
"@types/estree-jsx": "^1.0.5",
55
"@types/node": "^20.2.5",
56
+ "@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0",
57
+ "@typescript-eslint/parser-v3": "npm:@typescript-eslint/parser@^3.10.0",
58
+ "@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@^4.1.0",
59
+ "@typescript-eslint/parser-v5": "npm:@typescript-eslint/parser@^5.62.0",
60
"babel-eslint": "^10.0.3",
61
"eslint-v7": "npm:eslint@^7.7.0",
62
"eslint-v8": "npm:eslint@^8.57.1",
packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts
+8
-23
@@ -17,7 +17,6 @@ import BabelPluginReactCompiler, {
17
LoggerEvent,
18
} from 'babel-plugin-react-compiler';
19
import type {SourceCode} from 'eslint';
20
-import * as HermesParser from 'hermes-parser';
20
import {isDeepStrictEqual} from 'util';
21
import type {ParseResult} from '@babel/parser';
22
@@ -78,7 +77,6 @@ function getFlowSuppressions(
77
return results;
78
}
79
81
-
80
function runReactCompilerImpl({
81
sourceCode,
82
filename,
@@ -115,27 +113,14 @@ function runReactCompilerImpl({
113
}
114
115
let babelAST: ParseResult<File> | null = null;
118
- if (filename.endsWith('.tsx') || filename.endsWith('.ts')) {
119
- try {
120
- babelAST = babelParse(sourceCode.text, {
121
- sourceFilename: filename,
122
- sourceType: 'unambiguous',
123
- plugins: ['typescript', 'jsx'],
124
- });
125
- } catch {
126
- /* empty */
127
- }
128
- } else {
129
- try {
130
- babelAST = HermesParser.parse(sourceCode.text, {
131
- babel: true,
132
- enableExperimentalComponentSyntax: true,
133
- sourceFilename: filename,
134
- sourceType: 'module',
135
- });
136
- } catch {
137
- /* empty */
138
- }
116
+ try {
117
+ babelAST = babelParse(sourceCode.text, {
118
+ sourceFilename: filename,
119
+ sourceType: 'unambiguous',
120
+ plugins: ['typescript', 'jsx'],
121
+ });
122
+ } catch (err: unknown) {
123
+ /* empty */
124
}
125
126
if (babelAST != null) {
yarn.lock
-12
@@ -10190,11 +10190,6 @@ hermes-eslint@^0.32.0:
10190
hermes-estree "0.32.0"
10191
hermes-parser "0.32.0"
10192
10193
-hermes-estree@0.25.1:
10194
- version "0.25.1"
10195
- resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.25.1.tgz#6aeec17d1983b4eabf69721f3aa3eb705b17f480"
10196
- integrity sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==
10197
-
10193
hermes-estree@0.29.1:
10194
version "0.29.1"
10195
resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.29.1.tgz#043c7db076e0e8ef8c5f6ed23828d1ba463ebcc5"
@@ -10219,13 +10214,6 @@ hermes-parser@0.32.0, hermes-parser@^0.32.0:
10214
dependencies:
10215
hermes-estree "0.32.0"
10216
10222
-hermes-parser@^0.25.1:
10223
- version "0.25.1"
10224
- resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.25.1.tgz#5be0e487b2090886c62bd8a11724cd766d5f54d1"
10225
- integrity sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==
10226
- dependencies:
10227
- hermes-estree "0.25.1"
10228
-
10217
homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1:
10218
version "1.0.3"
10219
resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8"