Upgrade Flow to v0.56.0

Reviewed By: calebmer

Differential Revision: D5958715

fbshipit-source-id: 7feda03a9540e69bf8d9b4eb89720248ff43294f
This commit is contained in:
Sam Goldman 2017-10-02 20:59:10 -07:00 committed by Facebook Github Bot
parent f368287347
commit a16ef18a80
11 changed files with 45 additions and 31 deletions

View File

@ -46,12 +46,12 @@ suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-4]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-4]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.54.0
^0.56.0

View File

@ -912,7 +912,6 @@ if (Platform.OS === 'android') {
(ScrollView: React.ComponentType<any>),
nativeOnlyProps,
);
// $FlowFixMe (bvaughn) Update ComponentInterface in ViewPropTypes to include a string type (for Fiber host components) in a follow-up.
RCTScrollContentView = requireNativeComponent('RCTScrollContentView', View);
}

View File

@ -232,6 +232,12 @@ 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. */
JSInspector.registerAgent(require('NetworkAgent'));
}
}

View File

@ -58,9 +58,6 @@ class ImageBackground extends React.Component<$FlowFixMeProps> {
_viewRef: ?NativeMethodsMixinType = null;
_captureRef = ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
* suppresses an error when upgrading Flow's support for React. To see the
* error delete this comment and run Flow. */
this._viewRef = ref;
};

View File

@ -375,18 +375,12 @@ class VirtualizedList extends React.PureComponent<Props, State> {
*/
getScrollResponder() {
if (this._scrollRef && this._scrollRef.getScrollResponder) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for React.
* To see the error delete this comment and run Flow. */
return this._scrollRef.getScrollResponder();
}
}
getScrollableNode() {
if (this._scrollRef && this._scrollRef.getScrollableNode) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for React.
* To see the error delete this comment and run Flow. */
return this._scrollRef.getScrollableNode();
} else {
return ReactNative.findNodeHandle(this._scrollRef);
@ -395,9 +389,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
setNativeProps(props: Object) {
if (this._scrollRef) {
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for React.
* To see the error delete this comment and run Flow. */
this._scrollRef.setNativeProps(props);
}
}
@ -636,9 +627,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
<ListHeaderComponent />
);
cells.push(
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for React.
* To see the error delete this comment and run Flow. */
<View
key="$header"
onLayout={this._onLayoutHeader}
@ -747,9 +735,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
<ListEmptyComponent />
);
cells.push(
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for React.
* To see the error delete this comment and run Flow. */
<View
key="$empty"
onLayout={this._onLayoutEmpty}
@ -766,9 +751,6 @@ class VirtualizedList extends React.PureComponent<Props, State> {
<ListFooterComponent />
);
cells.push(
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for React.
* To see the error delete this comment and run Flow. */
<View
key="$footer"
onLayout={this._onLayoutFooter}

View File

@ -32,6 +32,12 @@ class StyleSheetValidation {
var message1 = '"' + prop + '" is not a valid style property.';
var message2 = '\nValid style props: ' +
JSON.stringify(Object.keys(allStylePropTypes).sort(), null, ' ');
/* $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. */
styleError(message1, style, caller, message2);
}
var error = allStylePropTypes[prop](
@ -43,6 +49,12 @@ class StyleSheetValidation {
ReactPropTypesSecret,
);
if (error) {
/* $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. */
styleError(error.message, style, caller);
}
}

View File

@ -50,9 +50,12 @@ import type {ConfigT} from 'metro-bundler';
function saveBundle(output, bundle, args) {
return Promise.resolve(
/* $FlowFixMe(>=0.54.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.54 was deployed. To see the error delete this
/* $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. */
output.save(bundle, args, log)
).then(() => bundle);
}

View File

@ -189,6 +189,12 @@ function attachHMRServer<TModule: Moduleish>(
Array.from(dependents).map(getModuleId);
}
/* $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. */
return {
dependenciesCache,
dependenciesModulesCache,

View File

@ -37,12 +37,12 @@ suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-4]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-4]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.54.0
^0.56.0

View File

@ -28,10 +28,16 @@ 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');
@ -43,6 +49,9 @@ 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');
});
});

View File

@ -198,7 +198,7 @@
"eslint-plugin-flowtype": "^2.33.0",
"eslint-plugin-prettier": "2.1.1",
"eslint-plugin-react": "^7.2.1",
"flow-bin": "^0.54.0",
"flow-bin": "^0.56.0",
"jest": "^21",
"mock-fs": "^4.4.1",
"prettier": "1.7.0",