@samitouri / QOS-React-2 / commits / 34464fb16c

Upgrade to Flow 0.196.3 (#25974)

After the previous changes these upgrade are easy. - removes config options that were removed - object index access now requires an indexer key in the type, this cause a handful of errors that were fixed - undefined keys error in all places, this needed a few extra suppressions for repeated undefined identifiers. Flow's [CHANGELOG.md](https://github.com/facebook/flow/blob/main/Changelog.md).

Jan Kassens committed Jan 9, 2023 at 17:52 UTC 34464fb16c2aec8202dab868eb381da0e807d771
8 files changed +17 -12
package.json
+1 -1
@@ -61,7 +61,7 @@
61 "eslint-plugin-react-internal": "link:./scripts/eslint-rules",
62 "fbjs-scripts": "1.2.0",
63 "filesize": "^6.0.1",
64 - "flow-bin": "^0.190.0",
64 + "flow-bin": "^0.196.3",
65 "flow-remove-types": "^2.196.1",
66 "glob": "^7.1.6",
67 "glob-stream": "^6.1.0",
packages/react-devtools-shared/src/backend/renderer.js
+2
@@ -3271,6 +3271,7 @@ export function attach(
3271 for (const method in console) {
3272 try {
3273 originalConsoleMethods[method] = console[method];
3274 + // $FlowFixMe[prop-missing]
3275 console[method] = () => {};
3276 } catch (error) {}
3277 }
@@ -3285,6 +3286,7 @@ export function attach(
3286 // Restore original console functionality.
3287 for (const method in originalConsoleMethods) {
3288 try {
3289 + // $FlowFixMe[prop-missing]
3290 console[method] = originalConsoleMethods[method];
3291 } catch (error) {}
3292 }
packages/react-devtools-shared/src/hydration.js
+1
@@ -248,6 +248,7 @@ export function dehydrate(
248 // Other types (e.g. typed arrays, Sets) will not spread correctly.
249 Array.from(data).forEach(
250 (item, i) =>
251 + // $FlowFixMe[prop-missing] Unserializable doesn't have an index signature
252 (unserializableValue[i] = dehydrate(
253 item,
254 cleaned,
packages/react-devtools-shell/src/app/console.js
+1
@@ -11,6 +11,7 @@ function ignoreStrings(
11 methodName: string,
12 stringsToIgnore: Array<string>,
13 ): void {
14 + // $FlowFixMe[prop-missing] index access only allowed for objects with index keys
15 console[methodName] = (...args) => {
16 const maybeString = args[0];
17 if (typeof maybeString === 'string') {
packages/react-reconciler/src/ReactFiberAct.js
+6 -3
@@ -23,9 +23,10 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean {
23 // to false.
24
25 const isReactActEnvironmentGlobal =
26 - // $FlowFixMe – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
26 + // $FlowFixMe[cannot-resolve-name] Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
27 typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined'
28 - ? IS_REACT_ACT_ENVIRONMENT
28 + ? // $FlowFixMe[cannot-resolve-name]
29 + IS_REACT_ACT_ENVIRONMENT
30 : undefined;
31
32 // $FlowFixMe - Flow doesn't know about jest
@@ -40,8 +41,10 @@ export function isLegacyActEnvironment(fiber: Fiber): boolean {
41 export function isConcurrentActEnvironment(): void | boolean {
42 if (__DEV__) {
43 const isReactActEnvironmentGlobal =
44 + // $FlowFixMe[cannot-resolve-name] Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global
45 typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined'
44 - ? IS_REACT_ACT_ENVIRONMENT
46 + ? // $FlowFixMe[cannot-resolve-name]
47 + IS_REACT_ACT_ENVIRONMENT
48 : undefined;
49
50 if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) {
packages/react-reconciler/src/ReactFiberFlags.js
+1 -1
@@ -67,7 +67,7 @@ export const MountPassiveDev = /* */ 0b100000000000000000000000000;
67 // Groups of flags that are used in the commit phase to skip over trees that
68 // don't contain effects, by checking subtreeFlags.
69
70 -export const BeforeMutationMask =
70 +export const BeforeMutationMask: number =
71 // TODO: Remove Update flag from before mutation phase by re-landing Visibility
72 // flag logic (see #20043)
73 Update |
scripts/flow/config/flowconfig
+1 -3
@@ -43,11 +43,9 @@ untyped-type-import=error
43 %CI_MAX_WORKERS%
44 exact_by_default=true
45 munge_underscores=false
46 -enforce_local_inference_annotations=true
47 -exact_empty_objects=true
46
47 # Substituted by createFlowConfig.js:
48 %REACT_RENDERER_FLOW_OPTIONS%
49
50 [version]
53 -^0.190.0
51 +^0.196.3
yarn.lock
+4 -4
@@ -7915,10 +7915,10 @@ flatted@^3.1.0:
7915 resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
7916 integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
7917
7918 -flow-bin@^0.190.0:
7919 - version "0.190.0"
7920 - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.190.0.tgz#cfc50e1474facf8150232a6c498fe66a6bb75969"
7921 - integrity sha512-Qo3bvN3cmGFXsq63ZxcHFZXQDvgx84fCuq8cXuKk5xbvuebBGwMqS+ku/rH+gEkciRrcTYrXqoSzb9b6ShcoJg==
7918 +flow-bin@^0.196.3:
7919 + version "0.196.3"
7920 + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.196.3.tgz#b6df48986a2629f2c6a26fb79d73fc07c8056af0"
7921 + integrity sha512-pmvjlksi1CvkSnDHpcfhDFj/KC3hwSgE2OpzvugW57dfgqfHzqX1UfZIcScGWM5AmP/IeOsQCW383k3zIbEnrA==
7922
7923 flow-parser@^0.196.1:
7924 version "0.196.1"