Skip to content

Commit 727e87e

Browse files
SamChou19815meta-codesync[bot]
authored andcommitted
Fully replace hermes-(estree|parser|eslint|transform) packages with flow-* counterparts in react-native (#57851)
Summary: Pull Request resolved: #57851 The flow-* packages have support for all latest syntax and is better maintained. Changelog: [Internal] Reviewed By: huntie Differential Revision: D115064040 fbshipit-source-id: 7265eb722910a460c76d0dbde0603cf962fe4e4e
1 parent ad37558 commit 727e87e

27 files changed

Lines changed: 91 additions & 101 deletions

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@
9393
"flow-eslint": "0.325.0",
9494
"flow-parser": "0.325.0",
9595
"flow-transform": "0.325.0",
96-
"hermes-eslint": "0.37.0",
97-
"hermes-transform": "0.37.0",
9896
"ini": "^5.0.0",
9997
"inquirer": "^7.1.0",
10098
"jest": "^29.7.0",

packages/eslint-plugin-react-native/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"devDependencies": {
2828
"babel-plugin-syntax-hermes-parser": "0.37.0",
2929
"flow-parser": "0.325.0",
30-
"flow-eslint": "0.325.0",
31-
"hermes-eslint": "0.37.0"
30+
"flow-eslint": "0.325.0"
3231
},
3332
"engines": {
3433
"node": "^22.13.0 || ^24.3.0 || >= 26.0.0"

packages/eslint-plugin-specs/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"source-map-support": "0.5.0"
4141
},
4242
"devDependencies": {
43-
"flow-eslint": "0.325.0",
44-
"hermes-eslint": "0.37.0"
43+
"flow-eslint": "0.325.0"
4544
},
4645
"engines": {
4746
"node": "^22.13.0 || ^24.3.0 || >= 26.0.0"

packages/react-native-babel-transformer/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"@babel/core": "^7.25.2",
3030
"@react-native/babel-preset": "0.87.0-main",
3131
"flow-parser": "0.325.0",
32-
"hermes-parser": "0.37.0",
3332
"nullthrows": "^1.1.1"
3433
},
3534
"peerDependencies": {

packages/react-native-codegen/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"@babel/core": "^7.25.2",
3333
"@babel/parser": "^7.29.0",
3434
"flow-parser": "0.325.0",
35-
"hermes-parser": "0.37.0",
3635
"invariant": "^2.2.4",
3736
"nullthrows": "^1.1.1",
3837
"tinyglobby": "^0.2.15",
@@ -48,7 +47,6 @@
4847
"@babel/preset-env": "^7.25.3",
4948
"babel-plugin-syntax-hermes-parser": "0.37.0",
5049
"flow-estree": "0.325.0",
51-
"hermes-estree": "0.37.0",
5250
"micromatch": "^4.0.4",
5351
"prettier": "3.9.4",
5452
"rimraf": "^3.0.2"

packages/react-native/Libraries/Animated/components/AnimatedFlatList.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ import FlatList, {type FlatListProps} from '../../Lists/FlatList';
1414
import createAnimatedComponent from '../createAnimatedComponent';
1515
import * as React from 'react';
1616

17-
export default createAnimatedComponent(FlatList) as $FlowFixMe as component<
17+
const AnimatedFlatList: component<
1818
// $FlowExpectedError[unclear-type]
1919
ItemT = any,
2020
>(
2121
ref?: React.RefSetter<FlatList<ItemT>>,
2222
...props: AnimatedProps<FlatListProps<ItemT>>
23-
);
23+
) = createAnimatedComponent(FlatList) as $FlowFixMe;
24+
25+
export default AnimatedFlatList;

packages/react-native/Libraries/Animated/components/AnimatedSectionList.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ import createAnimatedComponent from '../createAnimatedComponent';
1515
import * as React from 'react';
1616

1717
// $FlowFixMe[incompatible-type]
18-
export default createAnimatedComponent(SectionList) as $FlowFixMe as component<
18+
const AnimatedSectionList: component<
1919
// $FlowExpectedError[unclear-type]
2020
ItemT = any,
2121
// $FlowExpectedError[unclear-type]
2222
SectionT = any,
2323
>(
2424
ref?: React.RefSetter<SectionList<ItemT, SectionT>>,
2525
...props: AnimatedProps<SectionListProps<ItemT, SectionT>>
26-
);
26+
) = createAnimatedComponent(SectionList) as $FlowFixMe;
27+
28+
export default AnimatedSectionList;

packages/react-native/Libraries/Components/Pressable/Pressable.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ function usePressState(forcePressed: boolean): [boolean, (boolean) => void] {
370370
return [pressed || forcePressed, setPressed];
371371
}
372372

373-
const MemoedPressable = memo(Pressable);
374-
MemoedPressable.displayName = 'Pressable';
375-
376-
export default MemoedPressable as component(
373+
const MemoedPressable: component(
377374
ref?: React.RefSetter<PressableInstance>,
378375
...props: PressableProps
379-
);
376+
) = memo(Pressable);
377+
MemoedPressable.displayName = 'Pressable';
378+
379+
export default MemoedPressable;

packages/react-native/ReactNativeApi.d.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<040a8eb579cea089295c7137db40e0d6>>
7+
* @generated SignedSource<<4406ddb15814262a7ccc2b56e9625d67>>
88
*
99
* This file was generated by scripts/js-api/build-types/index.js.
1010
*/
@@ -22,11 +22,7 @@
2222
/* eslint-disable redundant-undefined/redundant-undefined */
2323

2424
import * as React from "react"
25-
declare const $$AnimatedFlatList: <ItemT = any>(
26-
props: Omit<AnimatedProps<FlatListProps<ItemT>>, "ref"> & {
27-
ref?: React.Ref<FlatList<ItemT>>
28-
},
29-
) => React.ReactNode
25+
declare const $$AnimatedFlatList: typeof AnimatedFlatList_default
3026
declare const $$AnimatedImage: AnimatedComponentType<
3127
React.JSX.LibraryManagedAttributes<
3228
typeof Image,
@@ -62,11 +58,7 @@ declare const $$AnimatedImplementation: {
6258
ValueXY: typeof AnimatedValueXY_default
6359
}
6460
declare const $$AnimatedScrollView: typeof AnimatedScrollView_default
65-
declare const $$AnimatedSectionList: <ItemT = any, SectionT = any>(
66-
props: Omit<AnimatedProps<SectionListProps<ItemT, SectionT>>, "ref"> & {
67-
ref?: React.Ref<SectionList<ItemT, SectionT>>
68-
},
69-
) => React.ReactNode
61+
declare const $$AnimatedSectionList: typeof AnimatedSectionList_default
7062
declare const $$AnimatedText: AnimatedComponentType<
7163
TextProps,
7264
React.ComponentRef<typeof Text>
@@ -145,10 +137,20 @@ declare const addImpl: (
145137
a: AnimatedNode_default | number,
146138
b: AnimatedNode_default | number,
147139
) => AnimatedAddition_default
140+
declare const AnimatedFlatList_default: <ItemT = any>(
141+
props: Omit<AnimatedProps<FlatListProps<ItemT>>, "ref"> & {
142+
ref?: React.Ref<FlatList<ItemT>>
143+
},
144+
) => React.ReactNode
148145
declare const AnimatedScrollView_default: AnimatedComponentType<
149146
ScrollViewProps,
150147
AnimatedScrollViewInstance
151148
>
149+
declare const AnimatedSectionList_default: <ItemT = any, SectionT = any>(
150+
props: Omit<AnimatedProps<SectionListProps<ItemT, SectionT>>, "ref"> & {
151+
ref?: React.Ref<SectionList<ItemT, SectionT>>
152+
},
153+
) => React.ReactNode
152154
declare const AppState: typeof AppState_default
153155
declare const AppState_default: AppStateImpl
154156
declare const AssetRegistry: {
@@ -269,6 +271,11 @@ declare const loopImpl: (
269271
animation: CompositeAnimation,
270272
$$PARAM_1$$?: LoopAnimationConfig,
271273
) => CompositeAnimation
274+
declare const MemoedPressable_default: (
275+
props: PressableProps & {
276+
ref?: React.Ref<PressableInstance>
277+
},
278+
) => React.ReactNode
272279
declare const Modal: typeof Wrapper_default
273280
declare const modulo: typeof $$AnimatedImplementation.modulo
274281
declare const moduloImpl: (
@@ -311,11 +318,7 @@ declare const Presets: {
311318
linear: LayoutAnimationConfig
312319
spring: LayoutAnimationConfig
313320
}
314-
declare const Pressable: (
315-
props: PressableProps & {
316-
ref?: React.Ref<PressableInstance>
317-
},
318-
) => React.ReactNode
321+
declare const Pressable: typeof MemoedPressable_default
319322
declare const processColor: typeof processColor_default
320323
declare const ProgressBarAndroid: typeof ProgressBarAndroid_default
321324
declare let ProgressBarAndroid_default: (
@@ -5722,7 +5725,7 @@ export {
57225725
AlertOptions, // 8a116d2a
57235726
AlertType, // 5ab91217
57245727
AndroidKeyboardEvent, // e03becc8
5725-
Animated, // 4bf77b70
5728+
Animated, // d74ec583
57265729
AppConfig, // 35c0ca70
57275730
AppRegistry, // 1e8c5a00
57285731
AppState, // 12012be5
@@ -5881,7 +5884,7 @@ export {
58815884
PointerEvent, // ff599afe
58825885
PressabilityConfig, // fea539a5
58835886
PressabilityEventHandlers, // c222648b
5884-
Pressable, // 7008c06f
5887+
Pressable, // ed5391ac
58855888
PressableAndroidRippleConfig, // ee32eaca
58865889
PressableInstance, // eebfe911
58875890
PressableProps, // d6bfa55b

packages/react-native/src/private/components/virtualcollection/column/VirtualColumn.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,15 @@ component VirtualColumnLayout(
2626
);
2727
}
2828

29-
const VirtualColumn = createVirtualCollectionView(
30-
VirtualColumnLayout,
31-
VirtualColumnGenerator,
32-
);
33-
3429
// TODO: Figure out component generic resolution.
3530
// @see https://fb.workplace.com/groups/flow/posts/29355518614070041
36-
// export default VirtualColumn as VirtualCollectionViewComponent<VirtualColumnLayoutProps>;
37-
export default VirtualColumn as component<out TItem extends Item>(
31+
// const VirtualColumn: VirtualCollectionViewComponent<VirtualColumnLayoutProps> = ...
32+
const VirtualColumn: component<out TItem extends Item>(
3833
children: (item: TItem, key: string) => React.Node,
3934
items: VirtualCollection<TItem>,
4035
itemToKey?: (TItem) => string,
4136
removeClippedSubviews?: boolean,
4237
testID?: ?string,
43-
);
38+
) = createVirtualCollectionView(VirtualColumnLayout, VirtualColumnGenerator);
39+
40+
export default VirtualColumn;

0 commit comments

Comments
 (0)