Skip to content

Commit 6ab29be

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Replace hermes-{parser,eslint} with flow-{parser,eslint} in OSS projects
Summary: Changelog: [Internal] Differential Revision: D114245899
1 parent c4f532e commit 6ab29be

4 files changed

Lines changed: 9 additions & 20 deletions

File tree

‎packages/react-native-babel-transformer/src/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ const transform /*: BabelTransformer['transform'] */ = ({
212212
!options.hermesParser
213213
? parseSync(src, babelConfig)
214214
: // $FlowFixMe[incompatible-exact]
215-
require('hermes-parser').parse(src, {
215+
require('flow-parser').parse(src, {
216216
babel: true,
217217
reactRuntimeTarget: '19',
218218
sourceType: babelConfig.sourceType,

‎packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap‎

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@ exports[`RN Codegen Flow Parser Fails with error message EMPTY_ENUM_NATIVE_MODUL
44

55
exports[`RN Codegen Flow Parser Fails with error message MAP_WITH_EXTRA_KEYS_NATIVE_MODULE 1`] = `"Module NativeSampleTurboModule: 'ObjectTypeAnnotation' cannot contain both an indexer and properties."`;
66

7-
exports[`RN Codegen Flow Parser Fails with error message MIXED_VALUES_ENUM_NATIVE_MODULE 1`] = `
8-
"Syntax error in path/NativeSampleTurboModule.js: cannot use string initializer in number enum (19:2)
9-
STR = 'str',
10-
^~~~~~~~~~~
11-
note: start of enum body (17:21)
12-
export enum SomeEnum {
13-
^"
14-
`;
7+
exports[`RN Codegen Flow Parser Fails with error message MIXED_VALUES_ENUM_NATIVE_MODULE 1`] = `"Module NativeSampleTurboModule: Failed parsing the enum SomeEnum in NativeSampleTurboModule with the error: Enums can not be mixed- they all must be either blank, number, or string values."`;
158

169
exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_ARRAY_BUFFER_IN_OBJECT_PROPERTY 1`] = `"Module NativeSampleTurboModule: Object property '[object Object]' cannot have type 'ArrayBuffer'."`;
1710

@@ -27,15 +20,11 @@ exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_REA
2720

2821
exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_UNNAMED_PARAMS 1`] = `"Module NativeSampleTurboModule: All function parameters must be named."`;
2922

30-
exports[`RN Codegen Flow Parser Fails with error message NUMERIC_VALUES_ENUM_NATIVE_MODULE 1`] = `
31-
"Syntax error in path/NativeSampleTurboModule.js: 'true', 'false', 'string', 'number' or 'bigint' expected in enum member initializer (20:17)
32-
SUBFACTORIAL = !5,
33-
~~~~~~~~~~~~~~~^"
34-
`;
23+
exports[`RN Codegen Flow Parser Fails with error message NUMERIC_VALUES_ENUM_NATIVE_MODULE 1`] = `"Syntax error in path/NativeSampleTurboModule.js: The enum member initializer for \`SUBFACTORIAL\` needs to be a literal (either a boolean, number, bigint, or string) in enum \`SomeEnum\`. (20:17)"`;
3524

3625
exports[`RN Codegen Flow Parser Fails with error message TWO_NATIVE_EXTENDING_TURBO_MODULE 1`] = `"Module NativeSampleTurboModule: Every NativeModule spec file must declare exactly one NativeModule Flow interface. This file declares 2: 'Spec', and 'Spec2'. Please remove the extraneous Flow interface declarations."`;
3726

38-
exports[`RN Codegen Flow Parser Fails with error message TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT 1`] = `"Module NativeSampleTurboModule: No Flow interfaces extending TurboModule were detected in this NativeModule spec."`;
27+
exports[`RN Codegen Flow Parser Fails with error message TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT 1`] = `"Syntax error in path/NativeSampleTurboModule.js: Duplicate export for \`default\` (19:7)"`;
3928

4029
exports[`RN Codegen Flow Parser can generate fixture ANDROID_ONLY_NATIVE_MODULE 1`] = `
4130
"{

‎packages/react-native-codegen/src/parsers/flow/parseFlowAndThrowErrors.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
'use strict';
1212

13-
import type {Program as ESTreeProgram} from 'hermes-estree';
13+
import type {Program as ESTreeProgram} from 'flow-estree';
1414

15-
const hermesParser = require('hermes-parser');
15+
const flowParser = require('flow-parser');
1616

1717
function parseFlowAndThrowErrors(
1818
code: string,
1919
options: Readonly<{filename?: ?string}> = {},
2020
): ESTreeProgram {
2121
let ast;
2222
try {
23-
ast = hermesParser.parse(code, {
23+
ast = flowParser.parse(code, {
2424
// Produce an ESTree-compliant AST
2525
babel: false,
2626
// Parse Flow without a pragma

‎private/react-native-fantom/repl/replTransform.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* @format
99
*/
1010

11-
import type {ESNode, Program} from 'hermes-estree';
11+
import type {ESNode, Program} from 'flow-estree';
1212

13-
import {parse} from 'hermes-parser';
13+
import {parse} from 'flow-parser';
1414

1515
export type TransformResult = {
1616
code: string,

0 commit comments

Comments
 (0)