From 4cba83c911a27237337aa842ec2a22e2b5745b77 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Mon, 9 Jan 2023 22:36:33 -0500 Subject: [PATCH] Remove unused Flow suppressions --- packages/react-cache/src/ReactCacheOld.js | 1 - packages/react-devtools-core/src/backend.js | 1 - packages/react-devtools-inline/src/backend.js | 1 - packages/react-devtools-inline/src/frontend.js | 1 - packages/react-devtools-shared/src/backend/utils.js | 1 - .../src/app/DeeplyNestedComponents/index.js | 1 - .../src/app/InspectableElements/UnserializableProps.js | 1 - .../react-dom-bindings/src/client/ReactDOMFloatClient.js | 1 - .../react-dom-bindings/src/server/ReactDOMFloatServer.js | 3 --- packages/react-reconciler/src/ReactFiberBeginWork.js | 1 - packages/react-reconciler/src/ReactFiberCommitWork.js | 3 --- packages/react-reconciler/src/ReactFiberContext.js | 1 - packages/react-reconciler/src/ReactFiberHooks.js | 1 - .../react-reconciler/src/ReactFiberOffscreenComponent.js | 1 - packages/react-reconciler/src/ReactFiberWorkLoop.js | 2 -- packages/react-refresh/src/ReactFreshRuntime.js | 5 +++-- packages/react-server/src/ReactFizzContext.js | 1 - packages/react-server/src/ReactFlightCache.js | 2 -- packages/react-server/src/ReactFlightServer.js | 1 - packages/react-server/src/ReactServerStreamConfigBun.js | 1 - packages/react/src/ReactDebugCurrentFrame.js | 4 +--- 21 files changed, 4 insertions(+), 30 deletions(-) diff --git a/packages/react-cache/src/ReactCacheOld.js b/packages/react-cache/src/ReactCacheOld.js index 99716076984c0..db316c7422db7 100644 --- a/packages/react-cache/src/ReactCacheOld.js +++ b/packages/react-cache/src/ReactCacheOld.js @@ -125,7 +125,6 @@ function accessResult( status: Pending, value: thenable, }; - // $FlowFixMe[escaped-generic] discovered when updating Flow const newEntry = lru.add(newResult, deleteEntry.bind(null, resource, key)); entriesForResource.set(key, newEntry); return newResult; diff --git a/packages/react-devtools-core/src/backend.js b/packages/react-devtools-core/src/backend.js index f14ece0eefd19..d2127b6d16363 100644 --- a/packages/react-devtools-core/src/backend.js +++ b/packages/react-devtools-core/src/backend.js @@ -148,7 +148,6 @@ export function connectToDevTools(options: ?ConnectOptions) { } }, }); - // $FlowFixMe[incompatible-use] found when upgrading Flow bridge.addListener( 'updateComponentFilters', (componentFilters: Array) => { diff --git a/packages/react-devtools-inline/src/backend.js b/packages/react-devtools-inline/src/backend.js index 659b6c8521c95..72d56cefe9094 100644 --- a/packages/react-devtools-inline/src/backend.js +++ b/packages/react-devtools-inline/src/backend.js @@ -81,7 +81,6 @@ export function activate( bridge, }: { bridge?: BackendBridge, - // $FlowFixMe[incompatible-exact] } = {}, ): void { if (bridge == null) { diff --git a/packages/react-devtools-inline/src/frontend.js b/packages/react-devtools-inline/src/frontend.js index 018ce76c5df25..5b9dd6e668872 100644 --- a/packages/react-devtools-inline/src/frontend.js +++ b/packages/react-devtools-inline/src/frontend.js @@ -63,7 +63,6 @@ export function initialize( }: { bridge?: FrontendBridge, store?: Store, - // $FlowFixMe[incompatible-exact] } = {}, ): React.AbstractComponent { if (bridge == null) { diff --git a/packages/react-devtools-shared/src/backend/utils.js b/packages/react-devtools-shared/src/backend/utils.js index 03e7800819af6..37f83f3099806 100644 --- a/packages/react-devtools-shared/src/backend/utils.js +++ b/packages/react-devtools-shared/src/backend/utils.js @@ -151,7 +151,6 @@ export function serializeToString(data: any): string { } cache.add(value); } - // $FlowFixMe if (typeof value === 'bigint') { return value.toString() + 'n'; } diff --git a/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js b/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js index 8c9a02e5e0c79..f1369896eda07 100644 --- a/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js +++ b/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js @@ -17,7 +17,6 @@ function wrapWithHoc(Component: () => any, index: number) { const displayName = (Component: any).displayName || Component.name; - // $FlowFixMe[incompatible-type] found when upgrading Flow HOC.displayName = `withHoc${index}(${displayName})`; return HOC; } diff --git a/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js b/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js index 9d006fb01f869..a5d2c33de8efe 100644 --- a/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js +++ b/packages/react-devtools-shell/src/app/InspectableElements/UnserializableProps.js @@ -31,7 +31,6 @@ const immutable = Immutable.fromJS({ xyz: 1, }, }); -// $FlowFixMe const bigInt = BigInt(123); // eslint-disable-line no-undef export default function UnserializableProps(): React.Node { diff --git a/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js b/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js index cfb770711fb93..cfcdabdb28abe 100644 --- a/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js +++ b/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js @@ -201,7 +201,6 @@ function getRootNode(container: Container): FloatRoot { function getCurrentResourceRoot(): null | FloatRoot { const currentContainer = getCurrentRootHostContainer(); - // $FlowFixMe flow should know currentContainer is a Node and has getRootNode return currentContainer ? getRootNode(currentContainer) : null; } diff --git a/packages/react-dom-bindings/src/server/ReactDOMFloatServer.js b/packages/react-dom-bindings/src/server/ReactDOMFloatServer.js index d25638809db27..e8aecf06c1550 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMFloatServer.js +++ b/packages/react-dom-bindings/src/server/ReactDOMFloatServer.js @@ -782,11 +782,9 @@ export function resourcesFromLink(props: Props): boolean { if (__DEV__) { validateLinkPropsForStyleResource(props); } - // $FlowFixMe[incompatible-use] found when upgrading Flow let preloadResource = resources.preloadsMap.get(href); if (!preloadResource) { preloadResource = createPreloadResource( - // $FlowFixMe[incompatible-call] found when upgrading Flow resources, href, 'style', @@ -937,7 +935,6 @@ export function resourcesFromScript(props: Props): boolean { let preloadResource = resources.preloadsMap.get(src); if (!preloadResource) { preloadResource = createPreloadResource( - // $FlowFixMe[incompatible-call] found when upgrading Flow resources, src, 'script', diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index 01c531ab034e9..fc593516be33c 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -599,7 +599,6 @@ function updateSimpleMemoComponent( try { outerMemoType = init(payload); } catch (x) { - // $FlowFixMe[incompatible-type] found when upgrading Flow outerMemoType = null; } // Inner propTypes will be validated in the function component path. diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index e58ecf95e0877..5002942ab3521 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -2391,12 +2391,9 @@ function getRetryCache(finishedWork: Fiber) { } case OffscreenComponent: { const instance: OffscreenInstance = finishedWork.stateNode; - // $FlowFixMe[incompatible-type-arg] found when upgrading Flow let retryCache: null | Set | WeakSet = - // $FlowFixMe[incompatible-type] found when upgrading Flow instance._retryCache; if (retryCache === null) { - // $FlowFixMe[incompatible-type] retryCache = instance._retryCache = new PossiblyWeakSet(); } return retryCache; diff --git a/packages/react-reconciler/src/ReactFiberContext.js b/packages/react-reconciler/src/ReactFiberContext.js index 264e39f05666b..06479e7e91cdf 100644 --- a/packages/react-reconciler/src/ReactFiberContext.js +++ b/packages/react-reconciler/src/ReactFiberContext.js @@ -24,7 +24,6 @@ if (__DEV__) { warnedAboutMissingGetChildContext = ({}: {[string]: boolean}); } -// $FlowFixMe[incompatible-exact] export const emptyContextObject: {} = {}; if (__DEV__) { Object.freeze(emptyContextObject); diff --git a/packages/react-reconciler/src/ReactFiberHooks.js b/packages/react-reconciler/src/ReactFiberHooks.js index 53d726aeb2d81..33ea6cd6ef94e 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.js +++ b/packages/react-reconciler/src/ReactFiberHooks.js @@ -2806,7 +2806,6 @@ const HooksDispatcherOnMount: Dispatcher = { useId: mountId, }; if (enableCache) { - // $FlowFixMe[escaped-generic] discovered when updating Flow (HooksDispatcherOnMount: Dispatcher).useCacheRefresh = mountRefresh; } if (enableUseHook) { diff --git a/packages/react-reconciler/src/ReactFiberOffscreenComponent.js b/packages/react-reconciler/src/ReactFiberOffscreenComponent.js index d8833779195d1..2f628d41ee502 100644 --- a/packages/react-reconciler/src/ReactFiberOffscreenComponent.js +++ b/packages/react-reconciler/src/ReactFiberOffscreenComponent.js @@ -54,7 +54,6 @@ export type OffscreenInstance = { _visibility: OffscreenVisibility, _pendingMarkers: Set | null, _transitions: Set | null, - // $FlowFixMe[incompatible-type-arg] found when upgrading Flow _retryCache: WeakSet | Set | null, // Represents the current Offscreen fiber diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index cd9f1498c655b..92cf27fd03e4a 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -1813,7 +1813,6 @@ function handleThrow(root: FiberRoot, thrownValue: any): void { const isWakeable = thrownValue !== null && typeof thrownValue === 'object' && - // $FlowFixMe[method-unbinding] typeof thrownValue.then === 'function'; workInProgressSuspendedReason = isWakeable @@ -3458,7 +3457,6 @@ export function resolveRetryWakeable(boundaryFiber: Fiber, wakeable: Wakeable) { break; case OffscreenComponent: { const instance: OffscreenInstance = boundaryFiber.stateNode; - // $FlowFixMe[incompatible-type] found when upgrading Flow retryCache = instance._retryCache; break; } diff --git a/packages/react-refresh/src/ReactFreshRuntime.js b/packages/react-refresh/src/ReactFreshRuntime.js index 68f0e6281e4ce..aff0619372924 100644 --- a/packages/react-refresh/src/ReactFreshRuntime.js +++ b/packages/react-refresh/src/ReactFreshRuntime.js @@ -50,8 +50,9 @@ const allFamiliesByID: Map = new Map(); const allFamiliesByType: | WeakMap | Map = new PossiblyWeakMap(); -const allSignaturesByType: // $FlowFixMe -WeakMap | Map = new PossiblyWeakMap(); +const allSignaturesByType: + | WeakMap + | Map = new PossiblyWeakMap(); // This WeakMap is read by React, so we only put families // that have actually been edited here. This keeps checks fast. const updatedFamiliesByType: diff --git a/packages/react-server/src/ReactFizzContext.js b/packages/react-server/src/ReactFizzContext.js index 48e2e20c32175..f3e9022b8ba6f 100644 --- a/packages/react-server/src/ReactFizzContext.js +++ b/packages/react-server/src/ReactFizzContext.js @@ -17,7 +17,6 @@ if (__DEV__) { warnedAboutMissingGetChildContext = ({}: {[string]: boolean}); } -// $FlowFixMe[incompatible-exact] export const emptyContextObject: {} = {}; if (__DEV__) { Object.freeze(emptyContextObject); diff --git a/packages/react-server/src/ReactFlightCache.js b/packages/react-server/src/ReactFlightCache.js index 20e5075118b6a..7ac8aaa66222f 100644 --- a/packages/react-server/src/ReactFlightCache.js +++ b/packages/react-server/src/ReactFlightCache.js @@ -36,7 +36,6 @@ export const DefaultCacheDispatcher: CacheDispatcher = { let entry: AbortSignal | void = (cache.get(createSignal): any); if (entry === undefined) { entry = createSignal(); - // $FlowFixMe[incompatible-use] found when upgrading Flow cache.set(createSignal, entry); } return entry; @@ -47,7 +46,6 @@ export const DefaultCacheDispatcher: CacheDispatcher = { if (entry === undefined) { entry = resourceType(); // TODO: Warn if undefined? - // $FlowFixMe[incompatible-use] found when upgrading Flow cache.set(resourceType, entry); } return entry; diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index acaece5541416..548a7f5252d28 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -1006,7 +1006,6 @@ export function resolveModelToJSON( return serializeByValueID(symbolId); } - // $FlowFixMe: bigint isn't added to Flow yet. if (typeof value === 'bigint') { throw new Error( `BigInt (${value}) is not yet supported in Client Component props.` + diff --git a/packages/react-server/src/ReactServerStreamConfigBun.js b/packages/react-server/src/ReactServerStreamConfigBun.js index fd90c17a3d1e0..addbd5111325b 100644 --- a/packages/react-server/src/ReactServerStreamConfigBun.js +++ b/packages/react-server/src/ReactServerStreamConfigBun.js @@ -71,7 +71,6 @@ export function clonePrecomputedChunk( } export function closeWithError(destination: Destination, error: mixed): void { - // $FlowFixMe[method-unbinding] if (typeof destination.error === 'function') { // $FlowFixMe: This is an Error object or the destination accepts other types. destination.error(error); diff --git a/packages/react/src/ReactDebugCurrentFrame.js b/packages/react/src/ReactDebugCurrentFrame.js index a29ec8c93e292..4be7e22cd2f77 100644 --- a/packages/react/src/ReactDebugCurrentFrame.js +++ b/packages/react/src/ReactDebugCurrentFrame.js @@ -11,9 +11,7 @@ const ReactDebugCurrentFrame: { setExtraStackFrame?: (stack: null | string) => void, getCurrentStack?: null | (() => string), getStackAddendum?: () => string, -} = - // $FlowFixMe[incompatible-exact] - {}; +} = {}; let currentExtraStackFrame = (null: null | string);