From da3424c929220304ff01032a9bf473fb251375f1 Mon Sep 17 00:00:00 2001 From: Caleb Meredith Date: Fri, 16 Feb 2018 19:59:54 -0800 Subject: [PATCH] @allow-large-files Upgrade xplat/js to Flow v0.66 Reviewed By: gabelevi Differential Revision: D7016717 fbshipit-source-id: 2bd2fd67074ba5d405ecd63a1aeb37354f8634c9 --- .flowconfig | 2 +- Libraries/CameraRoll/CameraRoll.js | 4 +++- Libraries/Components/TextInput/TextInput.js | 3 --- Libraries/Core/InitializeCore.js | 3 --- .../Experimental/SwipeableRow/SwipeableRow.js | 3 --- Libraries/Lists/FlatList.js | 6 ++++++ Libraries/Lists/MetroListView.js | 2 -- Libraries/Lists/SectionList.js | 3 +++ Libraries/Lists/VirtualizedList.js | 4 +++- Libraries/ReactNative/requireNativeComponent.js | 3 --- RNTester/js/CameraRollView.js | 1 - jest/preprocessor.js | 6 ------ local-cli/__tests__/fs-mock-test.js | 12 ------------ local-cli/bundle/buildBundle.js | 15 --------------- local-cli/bundle/types.flow.js | 3 --- local-cli/server/runServer.js | 9 --------- local-cli/templates/HelloWorld/_flowconfig | 2 +- package.json | 2 +- 18 files changed, 18 insertions(+), 65 deletions(-) diff --git a/.flowconfig b/.flowconfig index 735e7816a35829..b7aa19446d88dc 100644 --- a/.flowconfig +++ b/.flowconfig @@ -52,4 +52,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError [version] -^0.65.0 +^0.66.0 diff --git a/Libraries/CameraRoll/CameraRoll.js b/Libraries/CameraRoll/CameraRoll.js index 0c91dc7fd0233b..3bc48664f35db1 100644 --- a/Libraries/CameraRoll/CameraRoll.js +++ b/Libraries/CameraRoll/CameraRoll.js @@ -113,8 +113,10 @@ type GetPhotosReturn = Promise<{ * Shape of the return value of the `getPhotos` function. */ const getPhotosReturnChecker = createStrictShapeTypeChecker({ - // $FlowFixMe(>=0.41.0) edges: PropTypes.arrayOf( + /* $FlowFixMe(>=0.66.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.66 was deployed. To see the error delete this + * comment and run Flow. */ createStrictShapeTypeChecker({ node: createStrictShapeTypeChecker({ type: PropTypes.string.isRequired, diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index ab685dc75060c4..b9eb03bd67526e 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -31,9 +31,6 @@ const UIManager = require('UIManager'); const ViewPropTypes = require('ViewPropTypes'); const {ViewContextTypes} = require('ViewContext'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const emptyFunction = require('fbjs/lib/emptyFunction'); const invariant = require('fbjs/lib/invariant'); const requireNativeComponent = require('requireNativeComponent'); diff --git a/Libraries/Core/InitializeCore.js b/Libraries/Core/InitializeCore.js index 3e09e566078cca..3e6ebb680732bb 100644 --- a/Libraries/Core/InitializeCore.js +++ b/Libraries/Core/InitializeCore.js @@ -195,9 +195,6 @@ if (__DEV__) { // Set up inspector const JSInspector = require('JSInspector'); - /* $FlowFixMe(>=0.56.0 site=react_native_oss) This comment suppresses an - * error found when Flow v0.56 was deployed. To see the error delete this - * comment and run Flow. */ /* $FlowFixMe(>=0.56.0 site=react_native_fb,react_native_oss) This comment * suppresses an error found when Flow v0.56 was deployed. To see the error * delete this comment and run Flow. */ diff --git a/Libraries/Experimental/SwipeableRow/SwipeableRow.js b/Libraries/Experimental/SwipeableRow/SwipeableRow.js index e03970c637fa8b..80e627376e8482 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableRow.js +++ b/Libraries/Experimental/SwipeableRow/SwipeableRow.js @@ -22,9 +22,6 @@ const TimerMixin = require('react-timer-mixin'); const View = require('View'); const createReactClass = require('create-react-class'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const emptyFunction = require('fbjs/lib/emptyFunction'); const IS_RTL = I18nManager.isRTL; diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index dc0f5db8b5f8d3..e5b4a8310330c7 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -627,8 +627,14 @@ class FlatList extends React.PureComponent, void> { render() { if (this.props.legacyImplementation) { return ( + /* $FlowFixMe(>=0.66.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.66 was deployed. To see the error delete + * this comment and run Flow. */ =0.66.0 site=react_native_fb) This comment suppresses + * an error found when Flow v0.66 was deployed. To see the error + * delete this comment and run Flow. */ items={this.props.data} ref={this._captureRef} /> diff --git a/Libraries/Lists/MetroListView.js b/Libraries/Lists/MetroListView.js index 906164fa9e88f6..5f22eb264ee85b 100644 --- a/Libraries/Lists/MetroListView.js +++ b/Libraries/Lists/MetroListView.js @@ -50,8 +50,6 @@ type NormalProps = { type DefaultProps = { keyExtractor: (item: Item, index: number) => string, }; -/* $FlowFixMe - the renderItem passed in from SectionList is optional there but - * required here */ type Props = NormalProps & DefaultProps; /** diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index 3dfc99bd3a17dd..2404d26f54c72a 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -326,6 +326,9 @@ class SectionList> extends React.PureComponent< const List = this.props.legacyImplementation ? MetroListView : VirtualizedSectionList; + /* $FlowFixMe(>=0.66.0 site=react_native_fb) This comment suppresses an + * error found when Flow v0.66 was deployed. To see the error delete this + * comment and run Flow. */ return ; } diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 7ca090e88e1809..f40b44e404c4f6 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -52,7 +52,9 @@ type ViewabilityHelperCallbackTuple = { }; type RequiredProps = { - renderItem: renderItemType, + // TODO: Conflicts with the optional `renderItem` in + // `VirtualizedSectionList`'s props. + renderItem: $FlowFixMe, /** * The default accessor functions assume this is an Array<{key: string}> but you can override * getItem, getItemCount, and keyExtractor to handle any type of index-based data. diff --git a/Libraries/ReactNative/requireNativeComponent.js b/Libraries/ReactNative/requireNativeComponent.js index c4320c0a84b998..2a6c7c8ca71e8d 100644 --- a/Libraries/ReactNative/requireNativeComponent.js +++ b/Libraries/ReactNative/requireNativeComponent.js @@ -23,9 +23,6 @@ const processColor = require('processColor'); const resolveAssetSource = require('resolveAssetSource'); const sizesDiffer = require('sizesDiffer'); const verifyPropTypes = require('verifyPropTypes'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const invariant = require('fbjs/lib/invariant'); const warning = require('fbjs/lib/warning'); diff --git a/RNTester/js/CameraRollView.js b/RNTester/js/CameraRollView.js index fc1f063b2560c1..f69a4feed65fcb 100644 --- a/RNTester/js/CameraRollView.js +++ b/RNTester/js/CameraRollView.js @@ -72,7 +72,6 @@ var propTypes = { var CameraRollView = createReactClass({ displayName: 'CameraRollView', - // $FlowFixMe(>=0.41.0) propTypes: propTypes, getDefaultProps: function(): Object { diff --git a/jest/preprocessor.js b/jest/preprocessor.js index 6bc4dc9c531d1e..05b87ad5860015 100644 --- a/jest/preprocessor.js +++ b/jest/preprocessor.js @@ -11,9 +11,6 @@ 'use strict'; -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const babel = require('babel-core'); /* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error * found when Flow v0.54 was deployed. To see the error delete this comment and @@ -33,9 +30,6 @@ const nodeOptions = babelRegisterOnly.config([nodeFiles]); babelRegisterOnly([]); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const transformer = require('metro/src/transformer.js'); module.exports = { process(src/*: string*/, file/*: string*/) { diff --git a/local-cli/__tests__/fs-mock-test.js b/local-cli/__tests__/fs-mock-test.js index 46a3a9f96c9406..4928f3bd9ecf23 100644 --- a/local-cli/__tests__/fs-mock-test.js +++ b/local-cli/__tests__/fs-mock-test.js @@ -30,16 +30,10 @@ describe('fs mock', () => { it('stores content correctly', () => { fs.writeFileSync('/test', 'foobar', 'utf8'); const content = fs.readFileSync('/test', 'utf8'); - /* $FlowFixMe(>=0.56.0 site=react_native_oss) This comment suppresses an - * error found when Flow v0.56 was deployed. To see the error delete this - * comment and run Flow. */ expect(content).toEqual('foobar'); }); it('fails on missing path', () => { - /* $FlowFixMe(>=0.56.0 site=react_native_oss) This comment suppresses an - * error found when Flow v0.56 was deployed. To see the error delete this - * comment and run Flow. */ expect(() => fs.writeFileSync('/dir/test', 'foobar', 'utf8'), ).toThrowError('ENOENT: no such file or directory'); @@ -57,9 +51,6 @@ describe('fs mock', () => { fs.mkdirSync('/dir', 0o777); fs.writeFileSync('/dir/test', 'foobar', 'utf8'); const content = fs.readFileSync('/dir/test', 'utf8'); - /* $FlowFixMe(>=0.56.0 site=react_native_oss) This comment suppresses an - * error found when Flow v0.56 was deployed. To see the error delete this - * comment and run Flow. */ expect(content).toEqual('foobar'); }); @@ -68,9 +59,6 @@ describe('fs mock', () => { fs.writeFileSync('/dir/test', 'foobar', 'utf8'); fs.mkdirSync('/dir', 0o777); const content = fs.readFileSync('/dir/test', 'utf8'); - /* $FlowFixMe(>=0.56.0 site=react_native_oss) This comment suppresses an - * error found when Flow v0.56 was deployed. To see the error delete this - * comment and run Flow. */ expect(content).toEqual('foobar'); }); }); diff --git a/local-cli/bundle/buildBundle.js b/local-cli/bundle/buildBundle.js index 0d1ea067998002..524c1ac84eabf8 100644 --- a/local-cli/bundle/buildBundle.js +++ b/local-cli/bundle/buildBundle.js @@ -10,24 +10,12 @@ 'use strict'; const log = require('../util/log').out('bundle'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const Server = require('metro/src/Server'); const {Terminal} = require('metro-core'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const TerminalReporter = require('metro/src/lib/TerminalReporter'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const TransformCaching = require('metro/src/lib/TransformCaching'); const {defaults} = require('metro'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const outputBundle = require('metro/src/shared/output/bundle'); const path = require('path'); const saveAssets = require('./saveAssets'); @@ -40,9 +28,6 @@ import type {ConfigT} from 'metro'; const defaultAssetExts = defaults.assetExts; const defaultSourceExts = defaults.sourceExts; const defaultPlatforms = defaults.platforms; -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const defaultProvidesModuleNodeModules = defaults.providesModuleNodeModules; async function buildBundle( diff --git a/local-cli/bundle/types.flow.js b/local-cli/bundle/types.flow.js index 5c164d1ad2cf7c..4008030640d068 100644 --- a/local-cli/bundle/types.flow.js +++ b/local-cli/bundle/types.flow.js @@ -8,7 +8,4 @@ */ 'use strict'; -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ export type {OutputOptions, RequestOptions} from 'metro/src/shared/types.flow'; diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index 870652fc956ddc..4c821465d2248b 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -25,9 +25,6 @@ const copyToClipBoardMiddleware = require('./middleware/copyToClipBoardMiddlewar const defaultAssetExts = Metro.defaults.assetExts; const defaultSourceExts = Metro.defaults.sourceExts; const defaultPlatforms = Metro.defaults.platforms; -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const defaultProvidesModuleNodeModules = Metro.defaults.providesModuleNodeModules; const errorhandler = require('errorhandler'); @@ -46,17 +43,11 @@ const statusPageMiddleware = require('./middleware/statusPageMiddleware.js'); const systraceProfileMiddleware = require('./middleware/systraceProfileMiddleware.js'); const webSocketProxy = require('./util/webSocketProxy.js'); -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ const TransformCaching = require('metro/src/lib/TransformCaching'); const {ASSET_REGISTRY_PATH} = require('../core/Constants'); import type {ConfigT} from 'metro'; -/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error - * found when Flow v0.54 was deployed. To see the error delete this comment and - * run Flow. */ import type {Reporter} from 'metro/src/lib/reporting'; export type Args = {| diff --git a/local-cli/templates/HelloWorld/_flowconfig b/local-cli/templates/HelloWorld/_flowconfig index 10cb8d509a45a8..080b459b22fd77 100644 --- a/local-cli/templates/HelloWorld/_flowconfig +++ b/local-cli/templates/HelloWorld/_flowconfig @@ -51,4 +51,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError [version] -^0.65.0 +^0.66.0 diff --git a/package.json b/package.json index f57e73a70e80b0..db9bd84bfa8df4 100644 --- a/package.json +++ b/package.json @@ -214,7 +214,7 @@ "eslint-plugin-jest": "21.8.0", "eslint-plugin-prettier": "2.6.0", "eslint-plugin-react": "7.6.1", - "flow-bin": "^0.65.0", + "flow-bin": "^0.66.0", "jest": "22.3.0", "jest-junit": "3.6.0", "prettier": "1.9.1",