Skip to content

Commit

Permalink
Flow: remove unused suppressions (#25424)
Browse files Browse the repository at this point in the history
Removes $FlowFixMe's that are no longer needed.

Used flow/tool from the Flow repo:

```
 ~/Developer/flow/tool update-suppressions .
```
  • Loading branch information
kassens authored Oct 4, 2022
1 parent 9813ede commit ea04a48
Show file tree
Hide file tree
Showing 46 changed files with 11 additions and 113 deletions.
1 change: 0 additions & 1 deletion packages/react-cache/src/ReactCacheOld.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ function accessResult<I, K, V>(
);
const newResult: PendingResult = {
status: Pending,
// $FlowFixMe[method-unbinding]
value: thenable,
};
// $FlowFixMe[escaped-generic] discovered when updating Flow
Expand Down
1 change: 0 additions & 1 deletion packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ function initializeModelChunk<T>(chunk: ResolvedModelChunk<T>): 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions packages/react-devtools-shared/src/backend/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
}
Expand Down Expand Up @@ -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) {}
});
Expand Down Expand Up @@ -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) {}
}
Expand Down Expand Up @@ -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) {}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions packages/react-devtools-shared/src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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) {}
}
Expand All @@ -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) {}
}
Expand Down Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'});
}

Expand Down
1 change: 0 additions & 1 deletion packages/react-devtools-shared/src/devtools/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ function accessResult<Input, Key, Value>(
);
const newResult: PendingResult = {
status: Pending,
// $FlowFixMe[method-unbinding]
value: thenable,
};
entriesForResource.set(key, newResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
<HookView
key={index}
Expand Down Expand Up @@ -356,7 +355,6 @@ function HookView({
className={name !== '' ? styles.Name : styles.NameAnonymous}>
{hookDisplayName || 'Anonymous'}
</span>{' '}
{/* $FlowFixMe */}
<span className={styles.Value} onClick={toggleIsOpen}>
{displayValue}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ export default function Tree(props: Props): React.Node {
tabIndex={0}>
<AutoSizer>
{({height, width}) => (
// $FlowFixMe https://github.com/facebook/flow/issues/7341
<FixedSizeList
className={styles.List}
height={height}
Expand Down
2 changes: 0 additions & 2 deletions packages/react-devtools-shared/src/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ export function installHook(target: any): DevToolsHook | null {
unpatchFn = () => {
for (const method in originalConsoleMethods) {
try {
// $FlowFixMe property error|warn is not writable.
targetConsole[method] = originalConsoleMethods[method];
} catch (error) {}
}
Expand Down Expand Up @@ -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) {}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ function findHookNames(
}

const key = getHookSourceLocationKey(hookSource);
// $FlowFixMe[incompatible-call] found when upgrading Flow
map.set(key, name);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function wrapWithHoc(Component, index) {
return <Component />;
}

// $FlowFixMe
const displayName = Component.displayName || Component.name;

// $FlowFixMe[incompatible-type] found when upgrading Flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
memo,
Component,
Fragment,
// $FlowFixMe Flow doesn't know about the Profiler import yet
Profiler,
StrictMode,
Suspense,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) {
'onSelect',
);
if (listeners.length > 0) {
// $FlowFixMe[incompatible-type]
const event: ReactSyntheticEvent = new SyntheticEvent(
'onSelect',
'select',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ function extractEvents(
);
if (listeners.length > 0) {
// Intentionally create event lazily.
// $FlowFixMe[incompatible-type]
const event: ReactSyntheticEvent = new SyntheticEventCtor(
reactName,
reactEventType,
Expand Down Expand Up @@ -206,7 +205,6 @@ function extractEvents(
);
if (listeners.length > 0) {
// Intentionally create event lazily.
// $FlowFixMe[incompatible-type]
const event: ReactSyntheticEvent = new SyntheticEventCtor(
reactName,
reactEventType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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': {
Expand Down
1 change: 0 additions & 1 deletion packages/react-dom-bindings/src/shared/DOMProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down
1 change: 0 additions & 1 deletion packages/react-fs/src/ReactFilesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}

Expand Down
1 change: 0 additions & 1 deletion packages/react-reconciler/src/ReactFiberAct.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion packages/react-reconciler/src/ReactFiberAct.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions packages/react-reconciler/src/ReactFiberCommitWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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
) {
Expand Down
3 changes: 0 additions & 3 deletions packages/react-reconciler/src/ReactFiberCommitWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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
) {
Expand Down
Loading

0 comments on commit ea04a48

Please sign in to comment.