Skip to content

Commit 9fb581c

Browse files
c0dedancekassens
andauthored
Refactor: merge duplicate imports (#25489)
Co-authored-by: Jan Kassens <[email protected]>
1 parent bc35836 commit 9fb581c

30 files changed

+78
-78
lines changed

packages/react-devtools-shared/src/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ import {
4141
LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY,
4242
LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE,
4343
} from './constants';
44-
import {ElementTypeRoot} from 'react-devtools-shared/src/types';
4544
import {ComponentFilterElementType, ElementTypeHostComponent} from './types';
4645
import {
46+
ElementTypeRoot,
4747
ElementTypeClass,
4848
ElementTypeForwardRef,
4949
ElementTypeFunction,

packages/react-devtools-timeline/src/TimelineContext.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import type {ReactContext} from 'shared/ReactTypes';
10+
import type {ReactContext, RefObject} from 'shared/ReactTypes';
1111

1212
import * as React from 'react';
1313
import {
@@ -27,7 +27,6 @@ import type {
2727
ViewState,
2828
ReactEventInfo,
2929
} from './types';
30-
import type {RefObject} from 'shared/ReactTypes';
3130

3231
export type Context = {
3332
file: File | null,

packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import type {Size, IntrinsicSize} from './geometry';
10+
import type {Size, IntrinsicSize, Rect} from './geometry';
1111
import type {
1212
Interaction,
1313
MouseDownInteraction,
@@ -16,7 +16,6 @@ import type {
1616
WheelPlainInteraction,
1717
WheelWithShiftInteraction,
1818
} from './useCanvasInteraction';
19-
import type {Rect} from './geometry';
2019
import type {ScrollState} from './utils/scrollState';
2120
import type {ViewRefs} from './Surface';
2221
import type {ViewState} from '../types';

packages/react-devtools-timeline/src/view-base/VerticalScrollView.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
* @flow
88
*/
99

10-
import type {Size, IntrinsicSize} from './geometry';
10+
import type {Size, IntrinsicSize, Rect} from './geometry';
1111
import type {
1212
Interaction,
1313
MouseDownInteraction,
1414
MouseMoveInteraction,
1515
MouseUpInteraction,
1616
WheelWithShiftInteraction,
1717
} from './useCanvasInteraction';
18-
import type {Rect} from './geometry';
1918
import type {ScrollState} from './utils/scrollState';
2019
import type {ViewRefs} from './Surface';
2120
import type {ViewState} from '../types';

packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/VerticalScrollBarView.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
* @flow
88
*/
99

10-
import type {Interaction} from '../useCanvasInteraction';
1110
import type {Rect} from '../geometry';
1211
import type {Surface, ViewRefs} from '../Surface';
1312
import type {
13+
Interaction,
1414
ClickInteraction,
1515
MouseDownInteraction,
1616
MouseMoveInteraction,

packages/react-dom-bindings/src/client/ReactDOMHostConfig.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import {
2424
getFiberFromScopeInstance,
2525
getInstanceFromNode as getInstanceFromNodeDOMTree,
2626
isContainerMarkedAsRoot,
27+
detachDeletedInstance,
2728
} from './ReactDOMComponentTree';
28-
import {detachDeletedInstance} from './ReactDOMComponentTree';
2929
export {detachDeletedInstance};
3030
import {hasRole} from './DOMAccessibilityRoles';
3131
import {

packages/react-dom-bindings/src/events/DOMPluginEventSystem.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88
*/
99

1010
import type {DOMEventName} from './DOMEventNames';
11-
import {
12-
type EventSystemFlags,
13-
SHOULD_NOT_DEFER_CLICK_FOR_FB_SUPPORT_MODE,
14-
IS_LEGACY_FB_SUPPORT_MODE,
15-
SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS,
16-
} from './EventSystemFlags';
11+
import type {EventSystemFlags} from './EventSystemFlags';
1712
import type {AnyNativeEvent} from './PluginModuleType';
1813
import type {
1914
KnownReactSyntheticEvent,
@@ -23,6 +18,9 @@ import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
2318

2419
import {allNativeEvents} from './EventRegistry';
2520
import {
21+
SHOULD_NOT_DEFER_CLICK_FOR_FB_SUPPORT_MODE,
22+
IS_LEGACY_FB_SUPPORT_MODE,
23+
SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS,
2624
IS_CAPTURE_PHASE,
2725
IS_EVENT_HANDLE_NON_MANAGED_NODE,
2826
IS_NON_DELEGATED,
@@ -45,7 +43,7 @@ import {
4543
getEventListenerSet,
4644
getEventHandlerListeners,
4745
} from '../client/ReactDOMComponentTree';
48-
import {COMMENT_NODE} from '../shared/HTMLNodeType';
46+
import {COMMENT_NODE, DOCUMENT_NODE} from '../shared/HTMLNodeType';
4947
import {batchedUpdates} from './ReactDOMUpdateBatching';
5048
import getListener from './getListener';
5149
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
@@ -61,7 +59,6 @@ import {
6159
invokeGuardedCallbackAndCatchFirstError,
6260
rethrowCaughtError,
6361
} from 'shared/ReactErrorUtils';
64-
import {DOCUMENT_NODE} from '../shared/HTMLNodeType';
6562
import {createEventListenerWrapperWithPriority} from './ReactDOMEventListener';
6663
import {
6764
removeEventListener,

packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ import {
4343
accumulateSinglePhaseListeners,
4444
accumulateEventHandleNonManagedNodeListeners,
4545
} from '../DOMPluginEventSystem';
46-
import {IS_EVENT_HANDLE_NON_MANAGED_NODE} from '../EventSystemFlags';
46+
import {
47+
IS_EVENT_HANDLE_NON_MANAGED_NODE,
48+
IS_CAPTURE_PHASE,
49+
} from '../EventSystemFlags';
4750

4851
import getEventCharCode from '../getEventCharCode';
49-
import {IS_CAPTURE_PHASE} from '../EventSystemFlags';
5052

5153
import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';
5254

packages/react-dom/src/client/ReactDOMRoot.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ const {Dispatcher} = ReactDOMSharedInternals;
1818
import {ReactDOMClientDispatcher} from 'react-dom-bindings/src/client/ReactDOMFloatClient';
1919
import {queueExplicitHydrationTarget} from 'react-dom-bindings/src/events/ReactDOMEventReplaying';
2020
import {REACT_ELEMENT_TYPE} from 'shared/ReactSymbols';
21-
import {enableFloat, enableHostSingletons} from 'shared/ReactFeatureFlags';
21+
import {
22+
enableFloat,
23+
enableHostSingletons,
24+
allowConcurrentByDefault,
25+
disableCommentsAsDOMContainers,
26+
} from 'shared/ReactFeatureFlags';
2227

2328
export type RootType = {
2429
render(children: ReactNodeList): void,
@@ -73,10 +78,6 @@ import {
7378
isAlreadyRendering,
7479
} from 'react-reconciler/src/ReactFiberReconciler';
7580
import {ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
76-
import {
77-
allowConcurrentByDefault,
78-
disableCommentsAsDOMContainers,
79-
} from 'shared/ReactFeatureFlags';
8081

8182
/* global reportError */
8283
const defaultOnRecoverableError =

packages/react-dom/src/test-utils/ReactTestUtils.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ import {
2323
rethrowCaughtError,
2424
invokeGuardedCallbackAndCatchFirstError,
2525
} from 'shared/ReactErrorUtils';
26-
import {enableFloat} from 'shared/ReactFeatureFlags';
26+
import {enableFloat, enableHostSingletons} from 'shared/ReactFeatureFlags';
2727
import assign from 'shared/assign';
2828
import isArray from 'shared/isArray';
29-
import {enableHostSingletons} from 'shared/ReactFeatureFlags';
3029

3130
// Keep in sync with ReactDOM.js:
3231
const SecretInternals =

packages/react-native-renderer/src/ReactFabric.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
injectIntoDevTools,
2424
getPublicRootInstance,
2525
} from 'react-reconciler/src/ReactFiberReconciler';
26-
import {getInspectorDataForInstance} from './ReactNativeFiberInspector';
2726

2827
import {createPortal as createPortalImpl} from 'react-reconciler/src/ReactPortal';
2928
import {setBatchingImplementation} from './legacy-events/ReactGenericBatching';
@@ -39,6 +38,7 @@ import {getClosestInstanceFromNode} from './ReactFabricComponentTree';
3938
import {
4039
getInspectorDataForViewTag,
4140
getInspectorDataForViewAtPoint,
41+
getInspectorDataForInstance,
4242
} from './ReactNativeFiberInspector';
4343
import {LegacyRoot, ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
4444
import ReactSharedInternals from 'shared/ReactSharedInternals';

packages/react-native-renderer/src/ReactFabricEventEmitter.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@
77
* @flow
88
*/
99

10-
import type {AnyNativeEvent} from './legacy-events/PluginModuleType';
10+
import type {
11+
AnyNativeEvent,
12+
LegacyPluginModule,
13+
} from './legacy-events/PluginModuleType';
1114
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
12-
import type {LegacyPluginModule} from './legacy-events/PluginModuleType';
1315
import type {ReactSyntheticEvent} from './legacy-events/ReactSyntheticEventType';
1416
import type {
1517
RNTopLevelEventType,
1618
TopLevelType,
1719
} from './legacy-events/TopLevelEventTypes';
1820

19-
import {registrationNameModules} from './legacy-events/EventPluginRegistry';
21+
import {
22+
registrationNameModules,
23+
plugins,
24+
} from './legacy-events/EventPluginRegistry';
2025
import {batchedUpdates} from './legacy-events/ReactGenericBatching';
2126
import accumulateInto from './legacy-events/accumulateInto';
2227

23-
import {plugins} from './legacy-events/EventPluginRegistry';
2428
import getListeners from './ReactNativeGetListeners';
2529
import {runEventsInBatch} from './legacy-events/EventBatching';
2630

packages/react-native-renderer/src/ReactNativeEventEmitter.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@
77
* @flow
88
*/
99

10-
import type {AnyNativeEvent} from './legacy-events/PluginModuleType';
10+
import type {
11+
AnyNativeEvent,
12+
LegacyPluginModule,
13+
} from './legacy-events/PluginModuleType';
1114
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
12-
import type {LegacyPluginModule} from './legacy-events/PluginModuleType';
1315
import type {ReactSyntheticEvent} from './legacy-events/ReactSyntheticEventType';
1416
import type {TopLevelType} from './legacy-events/TopLevelEventTypes';
1517

16-
import {registrationNameModules} from './legacy-events/EventPluginRegistry';
18+
import {
19+
registrationNameModules,
20+
plugins,
21+
} from './legacy-events/EventPluginRegistry';
1722
import {batchedUpdates} from './legacy-events/ReactGenericBatching';
1823
import {runEventsInBatch} from './legacy-events/EventBatching';
19-
import {plugins} from './legacy-events/EventPluginRegistry';
2024
import getListeners from './ReactNativeGetListeners';
2125
import accumulateInto from './legacy-events/accumulateInto';
2226

packages/react-native-renderer/src/ReactNativeRenderer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ import {
3636
UIManager,
3737
legacySendAccessibilityEvent,
3838
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
39-
import {getInspectorDataForInstance} from './ReactNativeFiberInspector';
4039

4140
import {getClosestInstanceFromNode} from './ReactNativeComponentTree';
4241
import {
4342
getInspectorDataForViewTag,
4443
getInspectorDataForViewAtPoint,
44+
getInspectorDataForInstance,
4545
} from './ReactNativeFiberInspector';
4646
import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
4747
import ReactSharedInternals from 'shared/ReactSharedInternals';

packages/react-reconciler/src/ReactFiberBeginWork.new.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import type {
1111
ReactProviderType,
1212
ReactContext,
1313
ReactNodeList,
14+
MutableSource,
1415
} from 'shared/ReactTypes';
1516
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
1617
import type {Fiber, FiberRoot} from './ReactInternalTypes';
1718
import type {TypeOfMode} from './ReactTypeOfMode';
1819
import type {Lanes, Lane} from './ReactFiberLane.new';
19-
import type {MutableSource} from 'shared/ReactTypes';
2020
import type {
2121
SuspenseState,
2222
SuspenseListRenderState,

packages/react-reconciler/src/ReactFiberBeginWork.old.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import type {
1111
ReactProviderType,
1212
ReactContext,
1313
ReactNodeList,
14+
MutableSource,
1415
} from 'shared/ReactTypes';
1516
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
1617
import type {Fiber, FiberRoot} from './ReactInternalTypes';
1718
import type {TypeOfMode} from './ReactTypeOfMode';
1819
import type {Lanes, Lane} from './ReactFiberLane.old';
19-
import type {MutableSource} from 'shared/ReactTypes';
2020
import type {
2121
SuspenseState,
2222
SuspenseListRenderState,

packages/react-reconciler/src/ReactFiberCommitWork.new.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ import type {
1515
ChildSet,
1616
UpdatePayload,
1717
} from './ReactFiberHostConfig';
18-
import type {Fiber} from './ReactInternalTypes';
19-
import type {FiberRoot, EventFunctionWrapper} from './ReactInternalTypes';
18+
import type {
19+
Fiber,
20+
FiberRoot,
21+
EventFunctionWrapper,
22+
} from './ReactInternalTypes';
2023
import type {Lanes} from './ReactFiberLane.new';
2124
import type {SuspenseState} from './ReactFiberSuspenseComponent.new';
2225
import type {UpdateQueue} from './ReactFiberClassUpdateQueue.new';

packages/react-reconciler/src/ReactFiberCommitWork.old.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ import type {
1515
ChildSet,
1616
UpdatePayload,
1717
} from './ReactFiberHostConfig';
18-
import type {Fiber} from './ReactInternalTypes';
19-
import type {FiberRoot, EventFunctionWrapper} from './ReactInternalTypes';
18+
import type {
19+
Fiber,
20+
FiberRoot,
21+
EventFunctionWrapper,
22+
} from './ReactInternalTypes';
2023
import type {Lanes} from './ReactFiberLane.old';
2124
import type {SuspenseState} from './ReactFiberSuspenseComponent.old';
2225
import type {UpdateQueue} from './ReactFiberClassUpdateQueue.old';

packages/react-reconciler/src/ReactFiberCompleteWork.new.js

+7-10
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
* @flow
88
*/
99

10-
import type {Fiber} from './ReactInternalTypes';
10+
import type {Fiber, FiberRoot} from './ReactInternalTypes';
1111
import type {RootState} from './ReactFiberRoot.new';
1212
import type {Lanes, Lane} from './ReactFiberLane.new';
1313
import type {
1414
ReactScopeInstance,
1515
ReactContext,
1616
Wakeable,
1717
} from 'shared/ReactTypes';
18-
import type {FiberRoot} from './ReactInternalTypes';
1918
import type {
2019
Instance,
2120
Type,
@@ -34,6 +33,12 @@ import {
3433
enableSuspenseAvoidThisFallback,
3534
enableLegacyHidden,
3635
enableHostSingletons,
36+
enableSuspenseCallback,
37+
enableScopeAPI,
38+
enableProfilerTimer,
39+
enableCache,
40+
enableTransitionTracing,
41+
enableFloat,
3742
} from 'shared/ReactFeatureFlags';
3843

3944
import {resetWorkInProgressVersions as resetMutableSourceWorkInProgressVersions} from './ReactMutableSource.new';
@@ -144,14 +149,6 @@ import {
144149
hasUnhydratedTailNodes,
145150
upgradeHydrationErrorsToRecoverable,
146151
} from './ReactFiberHydrationContext.new';
147-
import {
148-
enableSuspenseCallback,
149-
enableScopeAPI,
150-
enableProfilerTimer,
151-
enableCache,
152-
enableTransitionTracing,
153-
enableFloat,
154-
} from 'shared/ReactFeatureFlags';
155152
import {
156153
renderDidSuspend,
157154
renderDidSuspendDelayIfPossible,

0 commit comments

Comments
 (0)