From 21db9fa2ba2b04a2080fa148418ae42207bc603f Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Tue, 4 Oct 2022 11:50:48 -0400 Subject: [PATCH] Flow upgrade to 0.182 ghstack-source-id: 58e651c26e8b5f878bf2d6a830d3929b5eaad928 Pull Request resolved: https://github.com/facebook/react/pull/25419 --- package.json | 2 +- packages/react-devtools-inline/src/backend.js | 1 + packages/react-devtools-inline/src/frontend.js | 1 + .../src/config/DevToolsFeatureFlags.core-fb.js | 6 ++---- .../src/config/DevToolsFeatureFlags.core-oss.js | 6 ++---- .../src/config/DevToolsFeatureFlags.extension-fb.js | 6 ++---- .../src/config/DevToolsFeatureFlags.extension-oss.js | 6 ++---- .../src/devtools/views/Settings/SettingsModal.js | 1 + .../react-dom-bindings/src/client/ReactDOMFloatClient.js | 1 + .../src/events/forks/EventListener-www.js | 5 +---- packages/react/src/ReactStartTransition.js | 3 +++ .../shared/forks/ReactFeatureFlags.native-fb-dynamic.js | 5 +---- packages/shared/forks/ReactFeatureFlags.native-fb.js | 6 ++---- packages/shared/forks/ReactFeatureFlags.native-oss.js | 6 ++---- packages/shared/forks/ReactFeatureFlags.test-renderer.js | 6 ++---- .../forks/ReactFeatureFlags.test-renderer.native.js | 6 ++---- .../shared/forks/ReactFeatureFlags.test-renderer.www.js | 6 ++---- packages/shared/forks/ReactFeatureFlags.testing.js | 6 ++---- packages/shared/forks/ReactFeatureFlags.testing.www.js | 6 ++---- packages/shared/forks/ReactFeatureFlags.www.js | 6 ++---- scripts/flow/config/flowconfig | 2 +- yarn.lock | 8 ++++---- 22 files changed, 39 insertions(+), 62 deletions(-) diff --git a/package.json b/package.json index 6b7571870f657..b3c25420349d6 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "eslint-plugin-react-internal": "link:./scripts/eslint-rules", "fbjs-scripts": "1.2.0", "filesize": "^6.0.1", - "flow-bin": "^0.176.0", + "flow-bin": "^0.182.0", "glob": "^7.1.6", "glob-stream": "^6.1.0", "google-closure-compiler": "^20200517.0.0", diff --git a/packages/react-devtools-inline/src/backend.js b/packages/react-devtools-inline/src/backend.js index 234c7f5f8853d..97d2368ac1696 100644 --- a/packages/react-devtools-inline/src/backend.js +++ b/packages/react-devtools-inline/src/backend.js @@ -80,6 +80,7 @@ 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 1e5ea336a477f..272fbba0b9265 100644 --- a/packages/react-devtools-inline/src/frontend.js +++ b/packages/react-devtools-inline/src/frontend.js @@ -62,6 +62,7 @@ export function initialize( }: { bridge?: FrontendBridge, store?: Store, + // $FlowFixMe[incompatible-exact] } = {}, ): React.AbstractComponent { if (bridge == null) { diff --git a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-fb.js b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-fb.js index 59b8e61a42ae1..41d7d0aa112a7 100644 --- a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-fb.js +++ b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-fb.js @@ -29,7 +29,5 @@ export const enableProfilerComponentTree = true; import typeof * as FeatureFlagsType from './DevToolsFeatureFlags.default'; import typeof * as ExportsType from './DevToolsFeatureFlags.core-fb'; -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +// Flow magic to verify the exports of this file match the original version. +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-oss.js b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-oss.js index 8102c6b751c92..1811dc34119b3 100644 --- a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-oss.js +++ b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.core-oss.js @@ -29,7 +29,5 @@ export const enableProfilerComponentTree = true; import typeof * as FeatureFlagsType from './DevToolsFeatureFlags.default'; import typeof * as ExportsType from './DevToolsFeatureFlags.core-oss'; -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +// Flow magic to verify the exports of this file match the original version. +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-fb.js b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-fb.js index 76d5546efb3d4..ffe795786b521 100644 --- a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-fb.js +++ b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-fb.js @@ -29,7 +29,5 @@ export const enableProfilerComponentTree = true; import typeof * as FeatureFlagsType from './DevToolsFeatureFlags.default'; import typeof * as ExportsType from './DevToolsFeatureFlags.extension-fb'; -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +// Flow magic to verify the exports of this file match the original version. +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-oss.js b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-oss.js index 2e6cabf4b56f1..b006b25e7df0b 100644 --- a/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-oss.js +++ b/packages/react-devtools-shared/src/config/DevToolsFeatureFlags.extension-oss.js @@ -29,7 +29,5 @@ export const enableProfilerComponentTree = true; import typeof * as FeatureFlagsType from './DevToolsFeatureFlags.default'; import typeof * as ExportsType from './DevToolsFeatureFlags.extension-oss'; -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +// Flow magic to verify the exports of this file match the original version. +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/react-devtools-shared/src/devtools/views/Settings/SettingsModal.js b/packages/react-devtools-shared/src/devtools/views/Settings/SettingsModal.js index 58377f9696b9b..bafaf237d472e 100644 --- a/packages/react-devtools-shared/src/devtools/views/Settings/SettingsModal.js +++ b/packages/react-devtools-shared/src/devtools/views/Settings/SettingsModal.js @@ -82,6 +82,7 @@ function SettingsModalImpl(_: {}) { case 'components': view = ; break; + // $FlowFixMe[incompatible-type] is this missing in TabID? case 'debugging': view = ; break; diff --git a/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js b/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js index 0658e14134770..dbe74440146fc 100644 --- a/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js +++ b/packages/react-dom-bindings/src/client/ReactDOMFloatClient.js @@ -657,6 +657,7 @@ function acquireStyleResource(resource: StyleResource): Instance { } } resource.count++; + // $FlowFixMe[incompatible-return] found when upgrading Flow return resource.instance; } diff --git a/packages/react-dom-bindings/src/events/forks/EventListener-www.js b/packages/react-dom-bindings/src/events/forks/EventListener-www.js index b9f20cca800ad..1055979bcf5d0 100644 --- a/packages/react-dom-bindings/src/events/forks/EventListener-www.js +++ b/packages/react-dom-bindings/src/events/forks/EventListener-www.js @@ -66,7 +66,4 @@ export function removeEventListener( } // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): EventListenerType): EventListenerShimType): EventListenerType); diff --git a/packages/react/src/ReactStartTransition.js b/packages/react/src/ReactStartTransition.js index 678daf9832ebc..daafea7e9e67e 100644 --- a/packages/react/src/ReactStartTransition.js +++ b/packages/react/src/ReactStartTransition.js @@ -26,7 +26,9 @@ export function startTransition( if (enableTransitionTracing) { if (options !== undefined && options.name !== undefined) { + // $FlowFixMe[incompatible-use] found when upgrading Flow ReactCurrentBatchConfig.transition.name = options.name; + // $FlowFixMe[incompatible-use] found when upgrading Flow ReactCurrentBatchConfig.transition.startTime = -1; } } @@ -46,6 +48,7 @@ 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/shared/forks/ReactFeatureFlags.native-fb-dynamic.js b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js index 7138679c536e7..6e9aaacf0e158 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js @@ -23,7 +23,4 @@ // update the test configuration. // // Flow magic to verify the exports of this file match the original version. -// // eslint-disable-next-line no-unused-vars -// type Check<_X, Y: _X, X: Y = _X> = null; -// // eslint-disable-next-line no-unused-expressions -// (null: Check); +// ((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index 821f947415dcd..beafb67bf0716 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -86,8 +86,6 @@ export const enableTransitionTracing = false; export const enableFloat = false; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index c63c2187005ae..3fdedac1118e1 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -75,8 +75,6 @@ export const enableTransitionTracing = false; export const enableFloat = false; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 665c42cb8f84d..ce7afbcef7084 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -75,8 +75,6 @@ export const enableTransitionTracing = false; export const enableFloat = false; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js index c48df6576ef6b..7d9054bfeb7de 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.native.js @@ -73,8 +73,6 @@ export const enableTransitionTracing = false; export const enableFloat = false; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index d4e135d655a05..38278fbc93d42 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -77,8 +77,6 @@ export const enableTransitionTracing = false; export const enableFloat = false; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.testing.js b/packages/shared/forks/ReactFeatureFlags.testing.js index f77ed6fa13620..308aaed94dfaa 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.js @@ -75,8 +75,6 @@ export const enableTransitionTracing = false; export const enableFloat = false; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.testing.www.js b/packages/shared/forks/ReactFeatureFlags.testing.www.js index 1c78538140e1b..89b24c8ed6d03 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.www.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.www.js @@ -76,8 +76,6 @@ export const enableTransitionTracing = false; export const enableFloat = false; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index f8566f9ecb2bd..1811c9bf7ce57 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -112,8 +112,6 @@ export const enableUseMutableSource = true; export const enableCustomElementPropertySupport = __EXPERIMENTAL__; export const useModernStrictMode = false; + // Flow magic to verify the exports of this file match the original version. -// eslint-disable-next-line no-unused-vars -type Check<_X, Y: _X, X: Y = _X> = null; -// eslint-disable-next-line no-unused-expressions -(null: Check); +((((null: any): ExportsType): FeatureFlagsType): ExportsType); diff --git a/scripts/flow/config/flowconfig b/scripts/flow/config/flowconfig index 470bd086920f3..fadeb06f0bb75 100644 --- a/scripts/flow/config/flowconfig +++ b/scripts/flow/config/flowconfig @@ -48,4 +48,4 @@ munge_underscores=false %REACT_RENDERER_FLOW_OPTIONS% [version] -^0.176.0 +^0.182.0 diff --git a/yarn.lock b/yarn.lock index e5bf340809a88..696a20379ab4a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7912,10 +7912,10 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== -flow-bin@^0.176.0: - version "0.176.3" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.176.3.tgz#d32de04e044ab474afe543b9fd245608bb6a6ac8" - integrity sha512-lbNqgjr2GlGLAEVp5+dhG4LdnFE7ekbvVNifAdlvTx58/nE8GrCOMiUwEQy4dLnfL2NIRMk2dbEVTrugeQJ3mA== +flow-bin@^0.182.0: + version "0.182.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.182.0.tgz#1dacbd72465743670412ada015d3182deda6f966" + integrity sha512-Ux90c2sMfoV/VVjOEFT2OHFJFnyfoIbTK/5AKAMnU4Skfru1G+FyS5YLu3XxQl0R6mpA9+rrFlPfYZq/5B+J3w== fluent-syntax@0.13.0: version "0.13.0"