Move suppression to primary locations in xplat/js

Summary:
We will soon be enforcing that flow suppressions will only apply when on an error's primary location ([post](https://fb.workplace.com/groups/179614562644215/permalink/559286354677032/)). This diff uses the codemod created in D20008770 to move all suppression comments to their primary locations in the  `xplat/js` flow root, and deletes suppression comments that are not on any primary locations.

This diff was generated with:
```
~/fbsource/fbcode/flow/packages/flow-dev-tools/bin/tool suppression-primary-locations --json-file ~/www/errors.json  ~/fbsource/xplat/js
hg st -n | xargs grep -l -P '@(partially-)?generated' | xargs hg revert
hg st -n | xargs grep -l 'format' | xargs prettier --write
```

Changelog: [Internal]

bypass-lint

Reviewed By: dsainati1

Differential Revision: D20122544

fbshipit-source-id: d94e409aadb18bb399a1ddbf9f3f2494fe4fb54c
This commit is contained in:
Hans Halverson authored and Facebook Github Bot committed 2020-02-27 12:14:57 -08:00
1 parent dbc35267a0
commit a3d9e91203
14 files changed
+53 -20

No files matched your search

@@ -23,10 +23,6 @@ type ExtrapolateType = 'extend' | 'identity' | 'clamp';
export type InterpolationConfigType = {
inputRange: $ReadOnlyArray<number>,
/* $FlowFixMe(>=0.38.0 site=react_native_fb,react_native_oss) - Flow error
* detected during the deployment of v0.38.0. To see the error, remove this
* comment and run flow
*/
outputRange: $ReadOnlyArray<number> | $ReadOnlyArray<string>,
easing?: (input: number) => number,
extrapolate?: ExtrapolateType,
@@ -222,11 +218,10 @@ function createInterpolationFromStringOutputRange(
});
});
/* $FlowFixMe(>=0.18.0): `outputRange[0].match()` can return `null`. Need to
* guard against this possibility.
*/
const interpolations = outputRange[0]
.match(stringShapeRegex)
/* $FlowFixMe(>=0.18.0): `outputRange[0].match()` can return `null`. Need
* to guard against this possibility. */
.map((value, i) => {
return createInterpolation({
...config,
@@ -363,6 +358,8 @@ class AnimatedInterpolation extends AnimatedWithChildren {
return {
inputRange: this._config.inputRange,
// Only the `outputRange` can contain strings so we don't need to transform `inputRange` here
/* $FlowFixMe(>=0.38.0) - Flow error detected during the deployment of
* v0.38.0. To see the error, remove this comment and run flow */
outputRange: this.__transformDataType(this._config.outputRange),
extrapolateLeft:
this._config.extrapolateLeft || this._config.extrapolate || 'extend',
@@ -1152,6 +1152,8 @@ function InternalTextInput(props: Props): React.Node {
onBlur={_onBlur}
onChange={_onChange}
onFocus={_onFocus}
/* $FlowFixMe the types for AndroidTextInput don't match up exactly
* with the props for TextInput. This will need to get fixed */
onScroll={_onScroll}
onSelectionChange={_onSelectionChange}
selection={selection}
+3 -3
View File
@@ -413,10 +413,10 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
}),
);
} else if (this.props.onViewableItemsChanged) {
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete this
* comment and run Flow. */
this._virtualizedListPairs.push({
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete
* this comment and run Flow. */
viewabilityConfig: this.props.viewabilityConfig,
onViewableItemsChanged: this._createOnViewableItemsChanged(
this.props.onViewableItemsChanged,
+9 -3
View File
@@ -75,9 +75,6 @@ export type ViewabilityConfig = {|
class ViewabilityHelper {
_config: ViewabilityConfig;
_hasInteracted: boolean = false;
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an error
* found when Flow v0.63 was deployed. To see the error delete this comment
* and run Flow. */
_timers: Set<number> = new Set();
_viewableIndices: Array<number> = [];
_viewableItems: Map<string, ViewToken> = new Map();
@@ -92,6 +89,9 @@ class ViewabilityHelper {
* Cleanup, e.g. on unmount. Clears any pending timers.
*/
dispose() {
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete this
* comment and run Flow. */
this._timers.forEach(clearTimeout);
}
@@ -227,6 +227,9 @@ class ViewabilityHelper {
this._viewableIndices = viewableIndices;
if (this._config.minimumViewTime) {
const handle = setTimeout(() => {
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete
* this comment and run Flow. */
this._timers.delete(handle);
this._onUpdateSync(
viewableIndices,
@@ -234,6 +237,9 @@ class ViewabilityHelper {
createViewToken,
);
}, this._config.minimumViewTime);
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete this
* comment and run Flow. */
this._timers.add(handle);
} else {
this._onUpdateSync(
@@ -35,11 +35,11 @@ module.exports = {
testBadDataWithTypicalItem(): React.Node {
const data = [
{
// $FlowExpectedError - bad title type 6, should be string
title: 6,
key: 1,
},
];
// $FlowExpectedError - bad title type 6, should be string
return <FlatList renderItem={renderMyListItem} data={data} />;
},
@@ -97,6 +97,7 @@ module.exports = {
/>,
// EverythingIsFine
<FlatList
// $FlowExpectedError - bad title type number, should be string
renderItem={(info: {item: {title: string, ...}, ...}) => <span />}
data={data}
/>,
@@ -57,8 +57,8 @@ module.exports = {
},
];
return [
// $FlowExpectedError - title should be inside `item`
<SectionList
// $FlowExpectedError - title should be inside `item`
renderItem={(info: {title: string, ...}) => <span />}
sections={sections}
/>,
@@ -94,9 +94,6 @@ module.exports = {
testBadSectionsShape(): React.Element<*> {
const sections = [
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete this
* comment and run Flow. */
{
key: 'a',
items: [
@@ -115,7 +112,6 @@ module.exports = {
const sections = [
{
key: 'a',
// $FlowExpectedError - section has bad meta data `fooNumber` field of type string
fooNumber: 'string',
data: [
{
@@ -129,6 +125,8 @@ module.exports = {
<SectionList
renderSectionHeader={renderMyHeader}
renderItem={renderMyListItem}
/* $FlowExpectedError - section has bad meta data `fooNumber` field of
* type string */
sections={sections}
/>
);
@@ -47,6 +47,9 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node {
animation,
rotate: animated.interpolate({
inputRange: [0, 1],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the deployment
* of v0.38.0. To see the error, remove this comment and run flow
*/
outputRange: ['0deg', '360deg'],
}),
});
@@ -66,8 +66,8 @@ module.exports = {
textStyle,
): ImageStyleProp);
// $FlowExpectedError - Incompatible type.
(StyleSheet.compose(
// $FlowExpectedError - Incompatible type.
[textStyle],
null,
): ImageStyleProp);
+2
View File
@@ -316,6 +316,8 @@ class RNTesterApp extends React.Component<Props, RNTesterNavigationState> {
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this._exampleRef &&
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
this._exampleRef.handleBackAction &&
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
* when making Flow check .android.js files. */
@@ -76,6 +76,9 @@ class AnimatedMaskExample extends React.Component<Props> {
{
rotate: this._maskRotateAnimatedValue.interpolate({
inputRange: [0, 360],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the
* deployment of v0.38.0. To see the error, remove this
* comment and run flow */
outputRange: ['0deg', '360deg'],
}),
},
@@ -145,6 +145,9 @@ class LoopExample extends React.Component<{...}, $FlowFixMeState> {
{
opacity: this.state.value.interpolate({
inputRange: [0, 0.5, 1],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the
* deployment of v0.38.0. To see the error, remove this comment
* and run flow */
outputRange: [0, 1, 0],
}),
},
@@ -240,6 +243,9 @@ class EventExample extends React.Component<{...}, $FlowFixMeState> {
{
rotate: this.state.anim.interpolate({
inputRange: [0, 1],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the
* deployment of v0.38.0. To see the error, remove this
* comment and run flow */
outputRange: ['0deg', '1deg'],
}),
},
@@ -39,10 +39,14 @@ class ScrollViewAnimatedExample extends Component<{...}> {
render(): React.Node {
const interpolated = this._scrollViewPos.interpolate({
inputRange: [0, 1],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the deployment of
* v0.38.0. To see the error, remove this comment and run flow */
outputRange: [0, 0.1],
});
const interpolated2 = this._scrollViewPos.interpolate({
inputRange: [0, 1],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the deployment of
* v0.38.0. To see the error, remove this comment and run flow */
outputRange: ['0deg', '1deg'],
});
return (
@@ -114,6 +114,8 @@ class AutogrowingTextInputExample extends React.Component<{...}> {
* found when making Flow check .android.js files. */
this.setState({contentSize: event.nativeEvent.contentSize})
}
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */
{...props}
/>
<Text>Plain text value representation:</Text>
@@ -40,6 +40,9 @@ function AnimateTansformSingleProp() {
{
rotate: theta.interpolate({
inputRange: [0, 100],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the
* deployment of v0.38.0. To see the error, remove this
* comment and run flow */
outputRange: ['0deg', '360deg'],
}),
},
@@ -78,6 +81,9 @@ function Flip() {
{
rotateX: theta.interpolate({
inputRange: [0, 180],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the
* deployment of v0.38.0. To see the error, remove this
* comment and run flow */
outputRange: ['0deg', '180deg'],
}),
},
@@ -96,6 +102,9 @@ function Flip() {
{
rotateX: theta.interpolate({
inputRange: [0, 180],
/* $FlowFixMe(>=0.38.0) - Flow error detected during the
* deployment of v0.38.0. To see the error, remove this
* comment and run flow */
outputRange: ['180deg', '360deg'],
}),
},