From ea04a486a7c27771f7eea896565c0980927ed3b4 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Tue, 4 Oct 2022 16:18:12 -0400 Subject: [PATCH] Flow: remove unused suppressions (#25424) Removes $FlowFixMe's that are no longer needed. Used flow/tool from the Flow repo: ``` ~/Developer/flow/tool update-suppressions . ``` --- packages/react-cache/src/ReactCacheOld.js | 1 - packages/react-client/src/ReactFlightClient.js | 1 - .../NativeStyleEditor/setupNativeStyleEditor.js | 1 - .../react-devtools-shared/src/backend/console.js | 4 ---- .../src/backend/profilingHooks.js | 1 - .../react-devtools-shared/src/backend/renderer.js | 4 ---- .../src/backend/views/Highlighter/index.js | 1 - .../react-devtools-shared/src/devtools/cache.js | 1 - .../views/Components/InspectedElementHooksTree.js | 2 -- .../src/devtools/views/Components/Tree.js | 1 - packages/react-devtools-shared/src/hook.js | 2 -- .../hooks/parseHookNames/parseSourceAndMetadata.js | 1 - .../src/inspectedElementMutableSource.js | 2 -- .../src/app/DeeplyNestedComponents/index.js | 1 - .../src/app/ElementTypes/index.js | 1 - .../src/view-base/utils/normalizeWheel.js | 10 ++-------- .../src/client/ReactDOMComponent.js | 1 - .../src/events/checkPassiveEvents.js | 1 - .../src/events/plugins/BeforeInputEventPlugin.js | 3 --- .../src/events/plugins/ChangeEventPlugin.js | 1 - .../src/events/plugins/EnterLeaveEventPlugin.js | 4 ---- .../src/events/plugins/SelectEventPlugin.js | 1 - .../src/events/plugins/SimpleEventPlugin.js | 2 -- .../src/server/ReactDOMServerFormatConfig.js | 2 -- .../react-dom-bindings/src/shared/DOMProperty.js | 1 - packages/react-fs/src/ReactFilesystem.js | 1 - packages/react-reconciler/src/ReactFiberAct.new.js | 1 - packages/react-reconciler/src/ReactFiberAct.old.js | 1 - .../src/ReactFiberCommitWork.new.js | 3 --- .../src/ReactFiberCommitWork.old.js | 3 --- .../src/ReactFiberCompleteWork.new.js | 2 -- .../src/ReactFiberCompleteWork.old.js | 2 -- .../react-reconciler/src/ReactFiberHooks.new.js | 1 - .../react-reconciler/src/ReactFiberHooks.old.js | 1 - .../src/ReactFiberHotReloading.new.js | 2 -- .../src/ReactFiberHotReloading.old.js | 2 -- .../react-reconciler/src/ReactFiberWorkLoop.new.js | 13 +------------ .../react-reconciler/src/ReactFiberWorkLoop.old.js | 13 +------------ packages/react-refresh/src/ReactFreshRuntime.js | 14 +++++++------- .../src/ReactFlightWebpackNodeRegister.js | 1 - packages/react-server/src/ReactFizzHooks.js | 3 --- packages/react-server/src/ReactFlightHooks.js | 1 - packages/react-server/src/ReactFlightServer.js | 3 --- .../src/ReactFlightServerConfigStream.js | 2 -- packages/react/src/ReactStartTransition.js | 2 -- packages/scheduler/src/forks/SchedulerMock.js | 3 --- 46 files changed, 11 insertions(+), 113 deletions(-) diff --git a/packages/react-cache/src/ReactCacheOld.js b/packages/react-cache/src/ReactCacheOld.js index edd75e5861c64..3661df00ca907 100644 --- a/packages/react-cache/src/ReactCacheOld.js +++ b/packages/react-cache/src/ReactCacheOld.js @@ -122,7 +122,6 @@ function accessResult( ); const newResult: PendingResult = { status: Pending, - // $FlowFixMe[method-unbinding] value: thenable, }; // $FlowFixMe[escaped-generic] discovered when updating Flow diff --git a/packages/react-client/src/ReactFlightClient.js b/packages/react-client/src/ReactFlightClient.js index 33db1c494b2d9..44815dce4b5b9 100644 --- a/packages/react-client/src/ReactFlightClient.js +++ b/packages/react-client/src/ReactFlightClient.js @@ -321,7 +321,6 @@ function initializeModelChunk(chunk: ResolvedModelChunk): void { initializingChunkBlockedModel !== null && initializingChunkBlockedModel.deps > 0 ) { - // $FlowFixMe[incompatible-type]: found when upgrading Flow initializingChunkBlockedModel.value = value; // We discovered new dependencies on modules that are not yet resolved. // We have to go the BLOCKED state until they're resolved. diff --git a/packages/react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor.js b/packages/react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor.js index fee2847f05e6d..22b9e74850e87 100644 --- a/packages/react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor.js +++ b/packages/react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor.js @@ -129,7 +129,6 @@ function measureStyle( return; } - // $FlowFixMe the parameter types of an unknown function are unknown instance.measure((x, y, width, height, left, top) => { // RN Android sometimes returns undefined here. Don't send measurements in this case. // https://github.com/jhen0409/react-native-debugger/issues/84#issuecomment-304611817 diff --git a/packages/react-devtools-shared/src/backend/console.js b/packages/react-devtools-shared/src/backend/console.js index 0ca957f216c6f..025180b872dae 100644 --- a/packages/react-devtools-shared/src/backend/console.js +++ b/packages/react-devtools-shared/src/backend/console.js @@ -181,7 +181,6 @@ export function patch({ unpatchFn = () => { for (const method in originalConsoleMethods) { try { - // $FlowFixMe property error|warn is not writable. targetConsole[method] = originalConsoleMethods[method]; } catch (error) {} } @@ -279,7 +278,6 @@ export function patch({ overrideMethod.__REACT_DEVTOOLS_ORIGINAL_METHOD__ = originalMethod; originalMethod.__REACT_DEVTOOLS_OVERRIDE_METHOD__ = overrideMethod; - // $FlowFixMe property error|warn is not writable. targetConsole[method] = overrideMethod; } catch (error) {} }); @@ -321,7 +319,6 @@ export function patchForStrictMode() { unpatchForStrictModeFn = () => { for (const method in originalConsoleMethods) { try { - // $FlowFixMe property error|warn is not writable. targetConsole[method] = originalConsoleMethods[method]; } catch (error) {} } @@ -355,7 +352,6 @@ export function patchForStrictMode() { overrideMethod.__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ = originalMethod; originalMethod.__REACT_DEVTOOLS_STRICT_MODE_OVERRIDE_METHOD__ = overrideMethod; - // $FlowFixMe property error|warn is not writable. targetConsole[method] = overrideMethod; } catch (error) {} }); diff --git a/packages/react-devtools-shared/src/backend/profilingHooks.js b/packages/react-devtools-shared/src/backend/profilingHooks.js index c91bb36a16148..5cadc175e4bfc 100644 --- a/packages/react-devtools-shared/src/backend/profilingHooks.js +++ b/packages/react-devtools-shared/src/backend/profilingHooks.js @@ -53,7 +53,6 @@ let supportsUserTimingV3 = false; if (supportsUserTiming) { const CHECK_V3_MARK = '__v3'; const markOptions = {}; - // $FlowFixMe: Ignore Flow complaining about needing a value Object.defineProperty(markOptions, 'startTime', { get: function() { supportsUserTimingV3 = true; diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index 4e9dbb3156c1c..bcf3d94ecca8c 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -387,7 +387,6 @@ export function getInternalReactConstants( const symbolOrNumber = typeof type === 'object' && type !== null ? type.$$typeof : type; - // $FlowFixMe Flow doesn't know about typeof "symbol" return typeof symbolOrNumber === 'symbol' ? // $FlowFixMe `toString()` doesn't match the type signature? symbolOrNumber.toString() @@ -3275,7 +3274,6 @@ export function attach( for (const method in console) { try { originalConsoleMethods[method] = console[method]; - // $FlowFixMe property error|warn is not writable. console[method] = () => {}; } catch (error) {} } @@ -3290,7 +3288,6 @@ export function attach( // Restore original console functionality. for (const method in originalConsoleMethods) { try { - // $FlowFixMe property error|warn is not writable. console[method] = originalConsoleMethods[method]; } catch (error) {} } @@ -3713,7 +3710,6 @@ export function attach( id, responseID: requestID, type: 'full-data', - // $FlowFixMe[incompatible-return] found when upgrading Flow // $FlowFixMe[prop-missing] found when upgrading Flow value: cleanedInspectedElement, }; diff --git a/packages/react-devtools-shared/src/backend/views/Highlighter/index.js b/packages/react-devtools-shared/src/backend/views/Highlighter/index.js index 3005f2481be06..4717db95162d4 100644 --- a/packages/react-devtools-shared/src/backend/views/Highlighter/index.js +++ b/packages/react-devtools-shared/src/backend/views/Highlighter/index.js @@ -119,7 +119,6 @@ export default function setupHighlighter( if (scrollIntoView && typeof node.scrollIntoView === 'function') { // If the node isn't visible show it before highlighting it. // We may want to reconsider this; it might be a little disruptive. - // $FlowFixMe Flow only knows about 'start' | 'end' node.scrollIntoView({block: 'nearest', inline: 'nearest'}); } diff --git a/packages/react-devtools-shared/src/devtools/cache.js b/packages/react-devtools-shared/src/devtools/cache.js index b0a01a443845a..8cc902d95f2a0 100644 --- a/packages/react-devtools-shared/src/devtools/cache.js +++ b/packages/react-devtools-shared/src/devtools/cache.js @@ -128,7 +128,6 @@ function accessResult( ); const newResult: PendingResult = { status: Pending, - // $FlowFixMe[method-unbinding] value: thenable, }; entriesForResource.set(key, newResult); diff --git a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js index 27e7ec69ce0b0..ce781506463cf 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/InspectedElementHooksTree.js @@ -138,7 +138,6 @@ export function InnerHooksTreeView({ inspectedElement, path, }: InnerHooksTreeViewProps): React.Node { - // $FlowFixMe "Missing type annotation for U" whatever that means return hooks.map((hook, index) => ( {hookDisplayName || 'Anonymous'} {' '} - {/* $FlowFixMe */} {displayValue} diff --git a/packages/react-devtools-shared/src/devtools/views/Components/Tree.js b/packages/react-devtools-shared/src/devtools/views/Components/Tree.js index 089d98ecebadb..64c779c2f2f51 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/Tree.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/Tree.js @@ -409,7 +409,6 @@ export default function Tree(props: Props): React.Node { tabIndex={0}> {({height, width}) => ( - // $FlowFixMe https://github.com/facebook/flow/issues/7341 { for (const method in originalConsoleMethods) { try { - // $FlowFixMe property error|warn is not writable. targetConsole[method] = originalConsoleMethods[method]; } catch (error) {} } @@ -302,7 +301,6 @@ export function installHook(target: any): DevToolsHook | null { overrideMethod.__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ = originalMethod; originalMethod.__REACT_DEVTOOLS_STRICT_MODE_OVERRIDE_METHOD__ = overrideMethod; - // $FlowFixMe property error|warn is not writable. targetConsole[method] = overrideMethod; } catch (error) {} }); diff --git a/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js b/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js index 15c3202b88457..ba3c1e096b67b 100644 --- a/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js +++ b/packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js @@ -186,7 +186,6 @@ function findHookNames( } const key = getHookSourceLocationKey(hookSource); - // $FlowFixMe[incompatible-call] found when upgrading Flow map.set(key, name); }); diff --git a/packages/react-devtools-shared/src/inspectedElementMutableSource.js b/packages/react-devtools-shared/src/inspectedElementMutableSource.js index 7c3704ee424fb..96021dd2ae25e 100644 --- a/packages/react-devtools-shared/src/inspectedElementMutableSource.js +++ b/packages/react-devtools-shared/src/inspectedElementMutableSource.js @@ -137,7 +137,6 @@ export function inspectElement({ // A path has been hydrated. // Merge it with the latest copy we have locally and resolve with the merged value. - // $FlowFixMe[incompatible-type] found when upgrading Flow inspectedElement = inspectedElementCache.get(id) || null; if (inspectedElement !== null) { // Clone element @@ -151,7 +150,6 @@ export function inspectElement({ hydrateHelper(value, ((path: any): Path)), ); - // $FlowFixMe[incompatible-call] found when upgrading Flow inspectedElementCache.set(id, inspectedElement); return [inspectedElement, type]; diff --git a/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js b/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js index dda89a3cd48e6..8e172a3ae55b7 100644 --- a/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js +++ b/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js @@ -15,7 +15,6 @@ function wrapWithHoc(Component, index) { return ; } - // $FlowFixMe const displayName = Component.displayName || Component.name; // $FlowFixMe[incompatible-type] found when upgrading Flow diff --git a/packages/react-devtools-shell/src/app/ElementTypes/index.js b/packages/react-devtools-shell/src/app/ElementTypes/index.js index d105bff9e1d05..c0e82bb925482 100644 --- a/packages/react-devtools-shell/src/app/ElementTypes/index.js +++ b/packages/react-devtools-shell/src/app/ElementTypes/index.js @@ -15,7 +15,6 @@ import { memo, Component, Fragment, - // $FlowFixMe Flow doesn't know about the Profiler import yet Profiler, StrictMode, Suspense, diff --git a/packages/react-devtools-timeline/src/view-base/utils/normalizeWheel.js b/packages/react-devtools-timeline/src/view-base/utils/normalizeWheel.js index 82fe9ec35c0ee..6e8a620b4e02e 100644 --- a/packages/react-devtools-timeline/src/view-base/utils/normalizeWheel.js +++ b/packages/react-devtools-timeline/src/view-base/utils/normalizeWheel.js @@ -71,17 +71,11 @@ export function normalizeWheel(event: WheelEvent): NormalizedWheelDelta { let deltaX = event.deltaX; let deltaY = event.deltaY; - if ( - // $FlowFixMe DOM_DELTA_LINE missing from WheelEvent - event.deltaMode === WheelEvent.DOM_DELTA_LINE - ) { + if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) { // delta in LINE units deltaX *= LINE_HEIGHT; deltaY *= LINE_HEIGHT; - } else if ( - // $FlowFixMe DOM_DELTA_PAGE missing from WheelEvent - event.deltaMode === WheelEvent.DOM_DELTA_PAGE - ) { + } else if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) { // delta in PAGE units deltaX *= PAGE_HEIGHT; deltaY *= PAGE_HEIGHT; diff --git a/packages/react-dom-bindings/src/client/ReactDOMComponent.js b/packages/react-dom-bindings/src/client/ReactDOMComponent.js index 17255b9fcc80d..25e37d01c2210 100644 --- a/packages/react-dom-bindings/src/client/ReactDOMComponent.js +++ b/packages/react-dom-bindings/src/client/ReactDOMComponent.js @@ -419,7 +419,6 @@ export function createElement( const firstChild = ((div.firstChild: any): HTMLScriptElement); domElement = div.removeChild(firstChild); } else if (typeof props.is === 'string') { - // $FlowFixMe `createElement` should be updated for Web Components domElement = ownerDocument.createElement(type, {is: props.is}); } else { // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. diff --git a/packages/react-dom-bindings/src/events/checkPassiveEvents.js b/packages/react-dom-bindings/src/events/checkPassiveEvents.js index 396060867414b..b67e87277d2e4 100644 --- a/packages/react-dom-bindings/src/events/checkPassiveEvents.js +++ b/packages/react-dom-bindings/src/events/checkPassiveEvents.js @@ -16,7 +16,6 @@ export let passiveBrowserEventsSupported: boolean = false; if (canUseDOM) { try { const options = {}; - // $FlowFixMe: Ignore Flow complaining about needing a value Object.defineProperty(options, 'passive', { get: function() { passiveBrowserEventsSupported = true; diff --git a/packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js b/packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js index a4554f6c9213a..d00e22b3bab69 100644 --- a/packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js +++ b/packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js @@ -227,10 +227,8 @@ function extractCompositionEvent( } } - // $FlowFixMe[incompatible-call] found when upgrading Flow const listeners = accumulateTwoPhaseListeners(targetInst, eventType); if (listeners.length > 0) { - // $FlowFixMe[incompatible-type] const event: ReactSyntheticEvent = new SyntheticCompositionEvent( eventType, domEventName, @@ -403,7 +401,6 @@ function extractBeforeInputEvent( const listeners = accumulateTwoPhaseListeners(targetInst, 'onBeforeInput'); if (listeners.length > 0) { - // $FlowFixMe[incompatible-type] const event: ReactSyntheticEvent = new SyntheticInputEvent( 'onBeforeInput', 'beforeinput', diff --git a/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js b/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js index cc99bd3ad1264..d4e397c3e9805 100644 --- a/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js +++ b/packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js @@ -59,7 +59,6 @@ function createAndAccumulateChangeEvent( enqueueStateRestore(((target: any): Node)); const listeners = accumulateTwoPhaseListeners(inst, 'onChange'); if (listeners.length > 0) { - // $FlowFixMe[incompatible-type] const event: ReactSyntheticEvent = new SyntheticEvent( 'onChange', 'change', diff --git a/packages/react-dom-bindings/src/events/plugins/EnterLeaveEventPlugin.js b/packages/react-dom-bindings/src/events/plugins/EnterLeaveEventPlugin.js index 4183b8785620a..29484a5cd5118 100644 --- a/packages/react-dom-bindings/src/events/plugins/EnterLeaveEventPlugin.js +++ b/packages/react-dom-bindings/src/events/plugins/EnterLeaveEventPlugin.js @@ -104,7 +104,6 @@ function extractEvents( const nearestMounted = getNearestMountedFiber(to); if ( to !== nearestMounted || - // $FlowFixMe[incompatible-use] found when upgrading Flow (to.tag !== HostComponent && to.tag !== HostText) ) { to = null; @@ -135,8 +134,6 @@ function extractEvents( const fromNode = from == null ? win : getNodeFromInstance(from); const toNode = to == null ? win : getNodeFromInstance(to); - // $FlowFixMe[prop-missing] - // $FlowFixMe[incompatible-type] const leave: KnownReactSyntheticEvent = new SyntheticEventCtor( leaveEventType, eventTypePrefix + 'leave', @@ -153,7 +150,6 @@ function extractEvents( // the first ancestor. Next time, we will ignore the event. const nativeTargetInst = getClosestInstanceFromNode((nativeEventTarget: any)); if (nativeTargetInst === targetInst) { - // $FlowFixMe[prop-missing] const enterEvent: KnownReactSyntheticEvent = new SyntheticEventCtor( enterEventType, eventTypePrefix + 'enter', diff --git a/packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js b/packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js index 2032b02565329..950b505fe9961 100644 --- a/packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js +++ b/packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js @@ -116,7 +116,6 @@ function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) { 'onSelect', ); if (listeners.length > 0) { - // $FlowFixMe[incompatible-type] const event: ReactSyntheticEvent = new SyntheticEvent( 'onSelect', 'select', diff --git a/packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js b/packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js index 07c9ec94c7104..78df13154b364 100644 --- a/packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js +++ b/packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js @@ -173,7 +173,6 @@ function extractEvents( ); if (listeners.length > 0) { // Intentionally create event lazily. - // $FlowFixMe[incompatible-type] const event: ReactSyntheticEvent = new SyntheticEventCtor( reactName, reactEventType, @@ -206,7 +205,6 @@ function extractEvents( ); if (listeners.length > 0) { // Intentionally create event lazily. - // $FlowFixMe[incompatible-type] const event: ReactSyntheticEvent = new SyntheticEventCtor( reactName, reactEventType, diff --git a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js index cedc935f7ac26..22429ac70d183 100644 --- a/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js +++ b/packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js @@ -511,7 +511,6 @@ function pushAttribute( // shouldRemoveAttribute switch (typeof value) { case 'function': - // $FlowFixMe symbol is perfectly valid here case 'symbol': // eslint-disable-line return; case 'boolean': { @@ -620,7 +619,6 @@ function pushAttribute( // shouldRemoveAttribute switch (typeof value) { case 'function': - // $FlowFixMe symbol is perfectly valid here case 'symbol': // eslint-disable-line return; case 'boolean': { diff --git a/packages/react-dom-bindings/src/shared/DOMProperty.js b/packages/react-dom-bindings/src/shared/DOMProperty.js index c4ae688aff35f..5333e47db580c 100644 --- a/packages/react-dom-bindings/src/shared/DOMProperty.js +++ b/packages/react-dom-bindings/src/shared/DOMProperty.js @@ -123,7 +123,6 @@ export function shouldRemoveAttributeWithWarning( } switch (typeof value) { case 'function': - // $FlowFixMe symbol is perfectly valid here case 'symbol': // eslint-disable-line return true; case 'boolean': { diff --git a/packages/react-fs/src/ReactFilesystem.js b/packages/react-fs/src/ReactFilesystem.js index 2d376a4dca940..c47ca6f256959 100644 --- a/packages/react-fs/src/ReactFilesystem.js +++ b/packages/react-fs/src/ReactFilesystem.js @@ -121,7 +121,6 @@ export function access(path: string, mode?: number): void { record = createRecordFromThenable(thenable); accessCache.push(mode, record); } - // $FlowFixMe[incompatible-call] found when upgrading Flow readRecord(record); // No return value. } diff --git a/packages/react-reconciler/src/ReactFiberAct.new.js b/packages/react-reconciler/src/ReactFiberAct.new.js index fbb12f4bd178b..bdad7161f6518 100644 --- a/packages/react-reconciler/src/ReactFiberAct.new.js +++ b/packages/react-reconciler/src/ReactFiberAct.new.js @@ -40,7 +40,6 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean { export function isConcurrentActEnvironment(): void | boolean { if (__DEV__) { const isReactActEnvironmentGlobal = - // $FlowFixMe – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; diff --git a/packages/react-reconciler/src/ReactFiberAct.old.js b/packages/react-reconciler/src/ReactFiberAct.old.js index 90f771b594059..7dc4eb7015b82 100644 --- a/packages/react-reconciler/src/ReactFiberAct.old.js +++ b/packages/react-reconciler/src/ReactFiberAct.old.js @@ -40,7 +40,6 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean { export function isConcurrentActEnvironment(): void | boolean { if (__DEV__) { const isReactActEnvironmentGlobal = - // $FlowFixMe – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.new.js b/packages/react-reconciler/src/ReactFiberCommitWork.new.js index 4066f37b3b02a..7e489ccfe74ba 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.new.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.new.js @@ -350,7 +350,6 @@ function commitBeforeMutationEffects_begin() { // Let's skip the whole loop if it's off. if (enableCreateEventHandleAPI) { // TODO: Should wrap this in flags check, too, as optimization - // $FlowFixMe[incompatible-use] found when upgrading Flow const deletions = fiber.deletions; if (deletions !== null) { for (let i = 0; i < deletions.length; i++) { @@ -360,10 +359,8 @@ function commitBeforeMutationEffects_begin() { } } - // $FlowFixMe[incompatible-use] found when upgrading Flow const child = fiber.child; if ( - // $FlowFixMe[incompatible-use] found when upgrading Flow (fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null ) { diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.old.js b/packages/react-reconciler/src/ReactFiberCommitWork.old.js index 0fd77ff2dd1d4..4957356c30383 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.old.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.old.js @@ -350,7 +350,6 @@ function commitBeforeMutationEffects_begin() { // Let's skip the whole loop if it's off. if (enableCreateEventHandleAPI) { // TODO: Should wrap this in flags check, too, as optimization - // $FlowFixMe[incompatible-use] found when upgrading Flow const deletions = fiber.deletions; if (deletions !== null) { for (let i = 0; i < deletions.length; i++) { @@ -360,10 +359,8 @@ function commitBeforeMutationEffects_begin() { } } - // $FlowFixMe[incompatible-use] found when upgrading Flow const child = fiber.child; if ( - // $FlowFixMe[incompatible-use] found when upgrading Flow (fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null ) { diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.new.js b/packages/react-reconciler/src/ReactFiberCompleteWork.new.js index b2bdbb0e0bca6..ef85cb32be9a2 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.new.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.new.js @@ -357,7 +357,6 @@ if (supportsMutation) { node = node.child; continue; } - // $FlowFixMe This is correct but Flow is confused by the labeled break. node = (node: Fiber); if (node === workInProgress) { return; @@ -425,7 +424,6 @@ if (supportsMutation) { node = node.child; continue; } - // $FlowFixMe This is correct but Flow is confused by the labeled break. node = (node: Fiber); if (node === workInProgress) { return; diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.old.js b/packages/react-reconciler/src/ReactFiberCompleteWork.old.js index e0d1dc4b66325..be5ff0d1ab3a8 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.old.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.old.js @@ -357,7 +357,6 @@ if (supportsMutation) { node = node.child; continue; } - // $FlowFixMe This is correct but Flow is confused by the labeled break. node = (node: Fiber); if (node === workInProgress) { return; @@ -425,7 +424,6 @@ if (supportsMutation) { node = node.child; continue; } - // $FlowFixMe This is correct but Flow is confused by the labeled break. node = (node: Fiber); if (node === workInProgress) { return; diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index 7ed2249524d8b..f430a4cad6baf 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -771,7 +771,6 @@ if (enableUseMemoCacheHook) { function use(usable: Usable): T { if (usable !== null && typeof usable === 'object') { // $FlowFixMe[method-unbinding] - // $FlowFixMe[prop-missing] if (typeof usable.then === 'function') { // This is a thenable. const thenable: Thenable = (usable: any); diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index 559b96fb1a209..d5add2ffec5c4 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -771,7 +771,6 @@ if (enableUseMemoCacheHook) { function use(usable: Usable): T { if (usable !== null && typeof usable === 'object') { // $FlowFixMe[method-unbinding] - // $FlowFixMe[prop-missing] if (typeof usable.then === 'function') { // This is a thenable. const thenable: Thenable = (usable: any); diff --git a/packages/react-reconciler/src/ReactFiberHotReloading.new.js b/packages/react-reconciler/src/ReactFiberHotReloading.new.js index 0b226a3de9a61..32ddb28afa365 100644 --- a/packages/react-reconciler/src/ReactFiberHotReloading.new.js +++ b/packages/react-reconciler/src/ReactFiberHotReloading.new.js @@ -51,7 +51,6 @@ import { import {enableFloat} from 'shared/ReactFeatureFlags'; let resolveFamily: RefreshHandler | null = null; -// $FlowFixMe Flow gets confused by a WeakSet feature check below. let failedBoundaries: WeakSet | null = null; export const setRefreshHandler = (handler: RefreshHandler | null): void => { @@ -212,7 +211,6 @@ export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) { return; } if (failedBoundaries === null) { - // $FlowFixMe Flow got confused by the feature check above. failedBoundaries = new WeakSet(); } failedBoundaries.add(fiber); diff --git a/packages/react-reconciler/src/ReactFiberHotReloading.old.js b/packages/react-reconciler/src/ReactFiberHotReloading.old.js index 91d045a8944cb..0b553eaad3162 100644 --- a/packages/react-reconciler/src/ReactFiberHotReloading.old.js +++ b/packages/react-reconciler/src/ReactFiberHotReloading.old.js @@ -51,7 +51,6 @@ import { import {enableFloat} from 'shared/ReactFeatureFlags'; let resolveFamily: RefreshHandler | null = null; -// $FlowFixMe Flow gets confused by a WeakSet feature check below. let failedBoundaries: WeakSet | null = null; export const setRefreshHandler = (handler: RefreshHandler | null): void => { @@ -212,7 +211,6 @@ export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) { return; } if (failedBoundaries === null) { - // $FlowFixMe Flow got confused by the feature check above. failedBoundaries = new WeakSet(); } failedBoundaries.add(fiber); diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index 90591f8f0ba76..ff1f2d02364a1 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -415,8 +415,6 @@ export function addMarkerProgressCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.markerProgress === null) { - // $FlowFixMe[incompatible-use] - // $FlowFixMe[incompatible-type] currentPendingTransitionCallbacks.markerProgress = new Map(); } @@ -445,8 +443,6 @@ export function addMarkerIncompleteCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.markerIncomplete === null) { - // $FlowFixMe[incompatible-use] found when upgrading Flow - // $FlowFixMe[incompatible-type] found when upgrading Flow currentPendingTransitionCallbacks.markerIncomplete = new Map(); } @@ -474,8 +470,6 @@ export function addMarkerCompleteCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.markerComplete === null) { - // $FlowFixMe[incompatible-use] found when upgrading Flow - // $FlowFixMe[incompatible-type] found when upgrading Flow currentPendingTransitionCallbacks.markerComplete = new Map(); } @@ -503,8 +497,6 @@ export function addTransitionProgressCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.transitionProgress === null) { - // $FlowFixMe[incompatible-use] found when upgrading Flow - // $FlowFixMe[incompatible-type] found when upgrading Flow currentPendingTransitionCallbacks.transitionProgress = new Map(); } @@ -1680,8 +1672,7 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber { if (workInProgress !== null) { let interruptedWork = workInProgressIsSuspended ? workInProgress - : // $FlowFixMe[incompatible-use] found when upgrading Flow - workInProgress.return; + : workInProgress.return; while (interruptedWork !== null) { const current = interruptedWork.alternate; unwindInterruptedWork( @@ -3065,12 +3056,10 @@ export function attachPingListener( pingCache.set(wakeable, threadIDs); } } - // $FlowFixMe[incompatible-use] found when upgrading Flow if (!threadIDs.has(lanes)) { workInProgressRootDidAttachPingListener = true; // Memoize using the thread ID to prevent redundant listeners. - // $FlowFixMe[incompatible-use] found when upgrading Flow threadIDs.add(lanes); const ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); if (enableUpdaterTracking) { diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index 49b62e545e0bb..9f9c70ff2c0dd 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -415,8 +415,6 @@ export function addMarkerProgressCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.markerProgress === null) { - // $FlowFixMe[incompatible-use] - // $FlowFixMe[incompatible-type] currentPendingTransitionCallbacks.markerProgress = new Map(); } @@ -445,8 +443,6 @@ export function addMarkerIncompleteCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.markerIncomplete === null) { - // $FlowFixMe[incompatible-use] found when upgrading Flow - // $FlowFixMe[incompatible-type] found when upgrading Flow currentPendingTransitionCallbacks.markerIncomplete = new Map(); } @@ -474,8 +470,6 @@ export function addMarkerCompleteCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.markerComplete === null) { - // $FlowFixMe[incompatible-use] found when upgrading Flow - // $FlowFixMe[incompatible-type] found when upgrading Flow currentPendingTransitionCallbacks.markerComplete = new Map(); } @@ -503,8 +497,6 @@ export function addTransitionProgressCallbackToPendingTransition( } if (currentPendingTransitionCallbacks.transitionProgress === null) { - // $FlowFixMe[incompatible-use] found when upgrading Flow - // $FlowFixMe[incompatible-type] found when upgrading Flow currentPendingTransitionCallbacks.transitionProgress = new Map(); } @@ -1680,8 +1672,7 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber { if (workInProgress !== null) { let interruptedWork = workInProgressIsSuspended ? workInProgress - : // $FlowFixMe[incompatible-use] found when upgrading Flow - workInProgress.return; + : workInProgress.return; while (interruptedWork !== null) { const current = interruptedWork.alternate; unwindInterruptedWork( @@ -3065,12 +3056,10 @@ export function attachPingListener( pingCache.set(wakeable, threadIDs); } } - // $FlowFixMe[incompatible-use] found when upgrading Flow if (!threadIDs.has(lanes)) { workInProgressRootDidAttachPingListener = true; // Memoize using the thread ID to prevent redundant listeners. - // $FlowFixMe[incompatible-use] found when upgrading Flow threadIDs.add(lanes); const ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); if (enableUpdaterTracking) { diff --git a/packages/react-refresh/src/ReactFreshRuntime.js b/packages/react-refresh/src/ReactFreshRuntime.js index 2a971185f337a..1cce12585e48a 100644 --- a/packages/react-refresh/src/ReactFreshRuntime.js +++ b/packages/react-refresh/src/ReactFreshRuntime.js @@ -47,15 +47,16 @@ const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // We never remove these associations. // It's OK to reference families, but use WeakMap/Set for types. const allFamiliesByID: Map = new Map(); -const allFamiliesByType: // $FlowFixMe -WeakMap | Map = new PossiblyWeakMap(); +const allFamiliesByType: + | WeakMap + | Map = new PossiblyWeakMap(); const allSignaturesByType: // $FlowFixMe 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. -// $FlowFixMe -const updatedFamiliesByType: // $FlowFixMe -WeakMap | Map = new PossiblyWeakMap(); +const updatedFamiliesByType: + | WeakMap + | Map = new PossiblyWeakMap(); // This is cleared on every performReactRefresh() call. // It is an array of [Family, NextType] tuples. @@ -74,8 +75,7 @@ const failedRoots: Set = new Set(); // In environments that support WeakMap, we also remember the last element for every root. // It needs to be weak because we do this even for roots that failed to mount. // If there is no WeakMap, we won't attempt to do retrying. -// $FlowFixMe -const rootElements: WeakMap | null = // $FlowFixMe +const rootElements: WeakMap | null = typeof WeakMap === 'function' ? new WeakMap() : null; let isPerformingRefresh = false; diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js index 4c9b3447d028c..6ddfa87bc657e 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js @@ -9,7 +9,6 @@ const url = require('url'); -// $FlowFixMe const Module = require('module'); module.exports = function register() { diff --git a/packages/react-server/src/ReactFizzHooks.js b/packages/react-server/src/ReactFizzHooks.js index d87c3a6daebf5..8db3f319e3cc1 100644 --- a/packages/react-server/src/ReactFizzHooks.js +++ b/packages/react-server/src/ReactFizzHooks.js @@ -184,7 +184,6 @@ function createWorkInProgressHook(): Hook { if (workInProgressHook.next === null) { isReRender = false; // Append to the end of the list - // $FlowFixMe[incompatible-use] found when upgrading Flow workInProgressHook = workInProgressHook.next = createHook(); } else { // There's already a work-in-progress. Reuse it. @@ -529,7 +528,6 @@ function throwOnUseEventCall() { export function useEvent) => Return>( callback: F, ): EventFunctionWrapper { - // $FlowIgnore[incompatible-return] useEvent doesn't work in Fizz return throwOnUseEventCall; } @@ -594,7 +592,6 @@ function useId(): string { function use(usable: Usable): T { if (usable !== null && typeof usable === 'object') { // $FlowFixMe[method-unbinding] - // $FlowFixMe[prop-missing] if (typeof usable.then === 'function') { // This is a thenable. const thenable: Thenable = (usable: any); diff --git a/packages/react-server/src/ReactFlightHooks.js b/packages/react-server/src/ReactFlightHooks.js index fe485824c93a4..07de6602e6288 100644 --- a/packages/react-server/src/ReactFlightHooks.js +++ b/packages/react-server/src/ReactFlightHooks.js @@ -146,7 +146,6 @@ function useId(): string { function use(usable: Usable): T { if (usable !== null && typeof usable === 'object') { // $FlowFixMe[method-unbinding] - // $FlowFixMe[prop-missing] if (typeof usable.then === 'function') { // This is a thenable. const thenable: Thenable = (usable: any); diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index 41ccc9867dd8a..02823183ea949 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -273,7 +273,6 @@ function attemptResolveElement( ); } } - // $FlowFixMe issue discovered when updating Flow return [ REACT_ELEMENT_TYPE, type, @@ -768,7 +767,6 @@ export function resolveModelToJSON( // $FlowFixMe `description` might be undefined const name: string = value.description; - // $FlowFixMe `name` might be undefined if (Symbol.for(name) !== value) { throw new Error( 'Only global symbols received from Symbol.for(...) can be passed to client components. ' + @@ -898,7 +896,6 @@ function emitModuleChunk( id: number, moduleMetaData: ModuleMetaData, ): void { - // $FlowFixMe ModuleMetaData is not a ReactModel const processedChunk = processModuleChunk(request, id, moduleMetaData); request.completedModuleChunks.push(processedChunk); } diff --git a/packages/react-server/src/ReactFlightServerConfigStream.js b/packages/react-server/src/ReactFlightServerConfigStream.js index 7944137288eb5..8aa9e96d9ddf6 100644 --- a/packages/react-server/src/ReactFlightServerConfigStream.js +++ b/packages/react-server/src/ReactFlightServerConfigStream.js @@ -121,7 +121,6 @@ export function processModelChunk( id: number, model: ReactModel, ): Chunk { - // $FlowFixMe: `json` might be `undefined` when model is a symbol. const json: string = stringify(model, request.toJSON); const row = serializeRowHeader('J', id) + json + '\n'; return stringToChunk(row); @@ -142,7 +141,6 @@ export function processModuleChunk( id: number, moduleMetaData: ReactModel, ): Chunk { - // $FlowFixMe: `json` might be `undefined` when moduleMetaData is a symbol. const json: string = stringify(moduleMetaData); const row = serializeRowHeader('M', id) + json + '\n'; return stringToChunk(row); diff --git a/packages/react/src/ReactStartTransition.js b/packages/react/src/ReactStartTransition.js index daafea7e9e67e..cf4359cf8d49f 100644 --- a/packages/react/src/ReactStartTransition.js +++ b/packages/react/src/ReactStartTransition.js @@ -20,7 +20,6 @@ export function startTransition( const currentTransition = ReactCurrentBatchConfig.transition; if (__DEV__) { - // $FlowFixMe[incompatible-use] found when upgrading Flow ReactCurrentBatchConfig.transition._updatedFibers = new Set(); } @@ -48,7 +47,6 @@ export function startTransition( 'Otherwise concurrent mode guarantees are off the table.', ); } - // $FlowFixMe[incompatible-use] found when upgrading Flow currentTransition._updatedFibers.clear(); } } diff --git a/packages/scheduler/src/forks/SchedulerMock.js b/packages/scheduler/src/forks/SchedulerMock.js index ef1d03a9bd595..389edcb699e35 100644 --- a/packages/scheduler/src/forks/SchedulerMock.js +++ b/packages/scheduler/src/forks/SchedulerMock.js @@ -520,7 +520,6 @@ function unstable_flushNumberOfYields(count: number): void { try { let hasMoreWork = true; do { - // $FlowFixMe[not-a-function] found when upgrading Flow hasMoreWork = cb(true, currentMockTime); } while (hasMoreWork && !didStop); if (!hasMoreWork) { @@ -546,7 +545,6 @@ function unstable_flushUntilNextPaint(): false { try { let hasMoreWork = true; do { - // $FlowFixMe[not-a-function] found when upgrading Flow hasMoreWork = cb(true, currentMockTime); } while (hasMoreWork && !didStop); if (!hasMoreWork) { @@ -593,7 +591,6 @@ function unstable_flushAllWithoutAsserting(): boolean { try { let hasMoreWork = true; do { - // $FlowFixMe[not-a-function] found when upgrading Flow hasMoreWork = cb(true, currentMockTime); } while (hasMoreWork); if (!hasMoreWork) {