From 84fd278af18015e6467442d493962e17ef03b617 Mon Sep 17 00:00:00 2001 From: Charlie Croom Date: Thu, 8 Apr 2021 15:05:34 -0400 Subject: [PATCH] Update flow to 0.148 Close #1980 --- .eslintrc | 2 +- .flowconfig | 9 +-------- package.json | 2 +- packages/benchmarks/src/app/Benchmark/index.js | 14 ++++++++++---- .../src/exports/Touchable/BoundingDimensions.js | 2 +- .../src/exports/useWindowDimensions/index.js | 5 +++-- .../react-native-web/src/modules/useEvent/index.js | 1 + yarn.lock | 8 ++++---- 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.eslintrc b/.eslintrc index d0d1b7ec..53e0250b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,7 +3,7 @@ "react": { "pragma": "React", "version": "16.6", - "flowVersion": "0.142.0" // Flow version + "flowVersion": "0.148.0" // Flow version } }, // babel parser to support ES6/7 features diff --git a/.flowconfig b/.flowconfig index 30d7ab18..f70d3418 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,5 +1,5 @@ [version] -^0.142.0 +^0.148.0 [ignore] /.*/__tests__/.* @@ -15,10 +15,3 @@ [options] munge_underscores=true -types_first=false -well_formed_exports=false -esproposal.optional_chaining=enable -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FlowFixMeProps -suppress_type=$FlowFixMeState diff --git a/package.json b/package.json index f62403f7..5daa8f71 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "eslint-plugin-promise": "^4.2.1", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", - "flow-bin": "^0.142.0", + "flow-bin": "^0.148.0", "glob": "^7.1.6", "husky": "^4.3.8", "inline-style-prefixer": "^6.0.0", diff --git a/packages/benchmarks/src/app/Benchmark/index.js b/packages/benchmarks/src/app/Benchmark/index.js index 1abe72ff..b61dee2b 100644 --- a/packages/benchmarks/src/app/Benchmark/index.js +++ b/packages/benchmarks/src/app/Benchmark/index.js @@ -7,6 +7,8 @@ /* global $Values */ +import type { Node } from 'react'; + import * as Timing from './timing'; import React, { Component } from 'react'; import { getMean, getMedian, getStdDev } from './math'; @@ -94,15 +96,19 @@ export default class Benchmark extends Component; - static displayName = 'Benchmark'; + static displayName: ?string = 'Benchmark'; - static defaultProps = { + static defaultProps: {| + sampleCount: number, + timeout: number, + type: $PropertyType + |} = { sampleCount: 50, timeout: 10000, // 10 seconds type: BenchmarkType.MOUNT }; - static Type = BenchmarkType; + static Type: typeof BenchmarkType = BenchmarkType; constructor(props: BenchmarkPropsType, context?: {}) { super(props, context); @@ -162,7 +168,7 @@ export default class Benchmark extends Component Dimensions.get('window')); useEffect(() => { function handleChange({ window }) { - // $FlowFixMe - setDims(window); + if (window != null) { + setDims(window); + } } Dimensions.addEventListener('change', handleChange); // We might have missed an update between calling `get` in render and diff --git a/packages/react-native-web/src/modules/useEvent/index.js b/packages/react-native-web/src/modules/useEvent/index.js index 736c18f3..024dbd14 100644 --- a/packages/react-native-web/src/modules/useEvent/index.js +++ b/packages/react-native-web/src/modules/useEvent/index.js @@ -60,5 +60,6 @@ export default function useEvent( }; }, [addListener]); + // $FlowFixMe return addListener; } diff --git a/yarn.lock b/yarn.lock index 46011ef5..622c25c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5321,10 +5321,10 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== -flow-bin@^0.142.0: - version "0.142.0" - resolved "https://registry.npmjs.org/flow-bin/-/flow-bin-0.142.0.tgz#b46b69de1123cf7c5a50917402968e07291df054" - integrity sha512-YgiapK/wrJjcgSgOWfoncbZ4vZrZWdHs+p7V9duI9zo4ehW2nM/VRrpSaWoZ+CWu3t+duGyAvupJvC6MM2l07w== +flow-bin@^0.148.0: + version "0.148.0" + resolved "https://registry.npmjs.org/flow-bin/-/flow-bin-0.148.0.tgz#1d264606dbb4d6e6070cc98a775e21dcd64e6890" + integrity sha512-7Cx6BUm8UAlbqtYJNYXdMrh900MQhNV+SjtBxZuWN7UmlVG4tIRNzNLEOjNnj2DN2vcL1wfI5IlSUXnws/QCEw== follow-redirects@^1.0.0, follow-redirects@^1.10.0: version "1.13.1"