From f0efa1164b7ca8523b081223954d05c88e92053b Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Thu, 1 Sep 2022 12:55:59 -0400 Subject: [PATCH] [flow] remove custom suppress comment config (#25170) --- packages/react-dom/src/client/ReactDOM.js | 4 ++-- packages/react-dom/src/client/ReactDOMComponent.js | 2 +- .../src/server/ReactDOMServerFormatConfig.js | 4 ++-- packages/react-dom/src/shared/DOMProperty.js | 2 +- packages/react-native-renderer/src/ReactFabric.js | 10 +++++----- .../react-native-renderer/src/ReactNativeRenderer.js | 2 +- packages/react-reconciler/src/ReactFiberAct.new.js | 6 +++--- packages/react-reconciler/src/ReactFiberAct.old.js | 6 +++--- packages/react-refresh/src/ReactFreshRuntime.js | 12 ++++++------ scripts/flow/config/flowconfig | 10 ---------- 10 files changed, 24 insertions(+), 34 deletions(-) diff --git a/packages/react-dom/src/client/ReactDOM.js b/packages/react-dom/src/client/ReactDOM.js index 1c66458840..406cda4f26 100644 --- a/packages/react-dom/src/client/ReactDOM.js +++ b/packages/react-dom/src/client/ReactDOM.js @@ -82,11 +82,11 @@ setAttemptHydrationAtPriority(runWithPriority); if (__DEV__) { if ( typeof Map !== 'function' || - // $FlowIssue Flow incorrectly thinks Map has no prototype + // $FlowFixMe Flow incorrectly thinks Map has no prototype Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || - // $FlowIssue Flow incorrectly thinks Set has no prototype + // $FlowFixMe Flow incorrectly thinks Set has no prototype Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function' diff --git a/packages/react-dom/src/client/ReactDOMComponent.js b/packages/react-dom/src/client/ReactDOMComponent.js index 8b48bae61a..defc3d93fc 100644 --- a/packages/react-dom/src/client/ReactDOMComponent.js +++ b/packages/react-dom/src/client/ReactDOMComponent.js @@ -420,7 +420,7 @@ export function createElement( const firstChild = ((div.firstChild: any): HTMLScriptElement); domElement = div.removeChild(firstChild); } else if (typeof props.is === 'string') { - // $FlowIssue `createElement` should be updated for Web Components + // $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/src/server/ReactDOMServerFormatConfig.js b/packages/react-dom/src/server/ReactDOMServerFormatConfig.js index 308e35a20b..c30d967326 100644 --- a/packages/react-dom/src/server/ReactDOMServerFormatConfig.js +++ b/packages/react-dom/src/server/ReactDOMServerFormatConfig.js @@ -477,7 +477,7 @@ function pushAttribute( // shouldRemoveAttribute switch (typeof value) { case 'function': - // $FlowIssue symbol is perfectly valid here + // $FlowFixMe symbol is perfectly valid here case 'symbol': // eslint-disable-line return; case 'boolean': { @@ -586,7 +586,7 @@ function pushAttribute( // shouldRemoveAttribute switch (typeof value) { case 'function': - // $FlowIssue symbol is perfectly valid here + // $FlowFixMe symbol is perfectly valid here case 'symbol': // eslint-disable-line return; case 'boolean': { diff --git a/packages/react-dom/src/shared/DOMProperty.js b/packages/react-dom/src/shared/DOMProperty.js index b5540debb7..f1d4ec132e 100644 --- a/packages/react-dom/src/shared/DOMProperty.js +++ b/packages/react-dom/src/shared/DOMProperty.js @@ -123,7 +123,7 @@ export function shouldRemoveAttributeWithWarning( } switch (typeof value) { case 'function': - // $FlowIssue symbol is perfectly valid here + // $FlowFixMe symbol is perfectly valid here case 'symbol': // eslint-disable-line return true; case 'boolean': { diff --git a/packages/react-native-renderer/src/ReactFabric.js b/packages/react-native-renderer/src/ReactFabric.js index e08a98653f..1010b4a4b8 100644 --- a/packages/react-native-renderer/src/ReactFabric.js +++ b/packages/react-native-renderer/src/ReactFabric.js @@ -69,14 +69,14 @@ function findHostInstance_DEPRECATED( if (componentOrHandle == null) { return null; } - // $FlowIssue Flow has hardcoded values for React DOM that don't work with RN + // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN if (componentOrHandle._nativeTag) { - // $FlowIssue Flow has hardcoded values for React DOM that don't work with RN + // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN return componentOrHandle; } - // $FlowIssue Flow has hardcoded values for React DOM that don't work with RN + // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag) { - // $FlowIssue Flow has hardcoded values for React DOM that don't work with RN + // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN return componentOrHandle.canonical; } let hostInstance; @@ -226,7 +226,7 @@ function render( } updateContainer(element, root, null, callback); - // $FlowIssue Flow has hardcoded values for React DOM that don't work with RN + // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN return getPublicRootInstance(root); } diff --git a/packages/react-native-renderer/src/ReactNativeRenderer.js b/packages/react-native-renderer/src/ReactNativeRenderer.js index e751195dda..046c4f4b93 100644 --- a/packages/react-native-renderer/src/ReactNativeRenderer.js +++ b/packages/react-native-renderer/src/ReactNativeRenderer.js @@ -222,7 +222,7 @@ function render( } updateContainer(element, root, null, callback); - // $FlowIssue Flow has hardcoded values for React DOM that don't work with RN + // $FlowFixMe Flow has hardcoded values for React DOM that don't work with RN return getPublicRootInstance(root); } diff --git a/packages/react-reconciler/src/ReactFiberAct.new.js b/packages/react-reconciler/src/ReactFiberAct.new.js index 27102b5e92..bad7fd3dc5 100644 --- a/packages/react-reconciler/src/ReactFiberAct.new.js +++ b/packages/react-reconciler/src/ReactFiberAct.new.js @@ -23,12 +23,12 @@ export function isLegacyActEnvironment(fiber: Fiber) { // to false. const isReactActEnvironmentGlobal = - // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + // $FlowFixMe – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; - // $FlowExpectedError - Flow doesn't know about jest + // $FlowFixMe - Flow doesn't know about jest const jestIsDefined = typeof jest !== 'undefined'; return ( warnsIfNotActing && jestIsDefined && isReactActEnvironmentGlobal !== false @@ -40,7 +40,7 @@ export function isLegacyActEnvironment(fiber: Fiber) { export function isConcurrentActEnvironment() { if (__DEV__) { const isReactActEnvironmentGlobal = - // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + // $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 bcb4ad707a..6358ab66a3 100644 --- a/packages/react-reconciler/src/ReactFiberAct.old.js +++ b/packages/react-reconciler/src/ReactFiberAct.old.js @@ -23,12 +23,12 @@ export function isLegacyActEnvironment(fiber: Fiber) { // to false. const isReactActEnvironmentGlobal = - // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + // $FlowFixMe – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; - // $FlowExpectedError - Flow doesn't know about jest + // $FlowFixMe - Flow doesn't know about jest const jestIsDefined = typeof jest !== 'undefined'; return ( warnsIfNotActing && jestIsDefined && isReactActEnvironmentGlobal !== false @@ -40,7 +40,7 @@ export function isLegacyActEnvironment(fiber: Fiber) { export function isConcurrentActEnvironment() { if (__DEV__) { const isReactActEnvironmentGlobal = - // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + // $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-refresh/src/ReactFreshRuntime.js b/packages/react-refresh/src/ReactFreshRuntime.js index 1ae5acfdfb..d50d7ce907 100644 --- a/packages/react-refresh/src/ReactFreshRuntime.js +++ b/packages/react-refresh/src/ReactFreshRuntime.js @@ -47,14 +47,14 @@ 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: // $FlowIssue +const allFamiliesByType: // $FlowFixMe WeakMap | Map = new PossiblyWeakMap(); -const allSignaturesByType: // $FlowIssue +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. -// $FlowIssue -const updatedFamiliesByType: // $FlowIssue +// $FlowFixMe +const updatedFamiliesByType: // $FlowFixMe WeakMap | Map = new PossiblyWeakMap(); // This is cleared on every performReactRefresh() call. @@ -74,8 +74,8 @@ 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. -// $FlowIssue -const rootElements: WeakMap | null = // $FlowIssue +// $FlowFixMe +const rootElements: WeakMap | null = // $FlowFixMe typeof WeakMap === 'function' ? new WeakMap() : null; let isPerformingRefresh = false; diff --git a/scripts/flow/config/flowconfig b/scripts/flow/config/flowconfig index c0647c9546..9c10ba265d 100644 --- a/scripts/flow/config/flowconfig +++ b/scripts/flow/config/flowconfig @@ -49,15 +49,5 @@ esproposal.optional_chaining=enable munge_underscores=false -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FixMe -suppress_type=$FlowExpectedError - -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy -suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError - [version] ^0.97.0