Skip to content

Commit

Permalink
Upgrade Flow to v0.56.0
Browse files Browse the repository at this point in the history
Reviewed By: calebmer

Differential Revision: D5958715

fbshipit-source-id: 7feda03a9540e69bf8d9b4eb89720248ff43294f
  • Loading branch information
samwgoldman authored and facebook-github-bot committed Oct 3, 2017
1 parent f368287 commit a16ef18
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion Libraries/Components/ScrollView/ScrollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 6 additions & 0 deletions Libraries/Core/InitializeCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}
3 changes: 0 additions & 3 deletions Libraries/Image/ImageBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
18 changes: 0 additions & 18 deletions Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand All @@ -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}
Expand Down
12 changes: 12 additions & 0 deletions Libraries/StyleSheet/StyleSheetValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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](
Expand All @@ -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);
}
}
Expand Down
7 changes: 5 additions & 2 deletions local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 6 additions & 0 deletions local-cli/server/util/attachHMRServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions local-cli/templates/HelloWorld/_flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions local-cli/util/__tests__/fs-mock-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
});
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a16ef18

Please sign in to comment.