diff --git a/packages/community-cli-plugin/src/commands/start/middleware.js b/packages/community-cli-plugin/src/commands/start/middleware.js index 8df3991cb42..919cc834ecc 100644 --- a/packages/community-cli-plugin/src/commands/start/middleware.js +++ b/packages/community-cli-plugin/src/commands/start/middleware.js @@ -31,9 +31,9 @@ type MiddlewareReturn = { ... }; -// $FlowFixMe +// $FlowFixMe[incompatible-type] const unusedStubWSServer: ws$WebSocketServer = {}; -// $FlowFixMe +// $FlowFixMe[incompatible-type] const unusedMiddlewareStub: Server = {}; const communityMiddlewareFallback = { diff --git a/packages/normalize-color/__tests__/normalizeColor-test.js b/packages/normalize-color/__tests__/normalizeColor-test.js index b9af70519b2..95a26a415ec 100644 --- a/packages/normalize-color/__tests__/normalizeColor-test.js +++ b/packages/normalize-color/__tests__/normalizeColor-test.js @@ -47,7 +47,7 @@ it('refuses non-spec compliant colors', () => { expect(normalizeColor('rgb (0, 1, 2)')).toBe(null); expect(normalizeColor('rgba(0 0 0 0.0)')).toBe(null); expect(normalizeColor('hsv(0, 1, 2)')).toBe(null); - // $FlowExpectedError - Intentionally malformed argument. + // $FlowExpectedError[incompatible-type] - Intentionally malformed argument. expect(normalizeColor({r: 10, g: 10, b: 10})).toBe(null); expect(normalizeColor('hsl(1%, 2, 3)')).toBe(null); expect(normalizeColor('rgb(1%, 2%, 3%)')).toBe(null); diff --git a/packages/react-native-babel-transformer/src/index.js b/packages/react-native-babel-transformer/src/index.js index 42cb9ed97b8..8ba7c3afe3d 100644 --- a/packages/react-native-babel-transformer/src/index.js +++ b/packages/react-native-babel-transformer/src/index.js @@ -218,7 +218,7 @@ const transform /*: BabelTransformer['transform'] */ = ({ // The result from `transformFromAstSync` can be null (if the file is ignored) if (!result) { - /* $FlowFixMe BabelTransformer specifies that the `ast` can never be null but + /* $FlowFixMe[incompatible-type] BabelTransformer specifies that the `ast` can never be null but * the function returns here. Discovered when typing `BabelNode`. */ return {ast: null}; } diff --git a/packages/react-native-compatibility-check/src/ErrorFormatting.js b/packages/react-native-compatibility-check/src/ErrorFormatting.js index f19c796661a..91e77078cf0 100644 --- a/packages/react-native-compatibility-check/src/ErrorFormatting.js +++ b/packages/react-native-compatibility-check/src/ErrorFormatting.js @@ -275,7 +275,7 @@ export function formatNativeSpecErrorStore( export function formatDiffSet(summary: DiffSummary): FormattedDiffSummary { const summaryStatus = summary.status; if (summaryStatus === 'ok' || summaryStatus === 'patchable') { - // $FlowFixMe I don't think we can ever get in this branch + // $FlowFixMe[incompatible-type] I don't think we can ever get in this branch return summary; } const hasteModules = Object.keys(summary.incompatibilityReport); diff --git a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js index 90d5356f0b9..7a1a1d7b32e 100644 --- a/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js +++ b/packages/react-native/Libraries/Animated/components/AnimatedScrollView.js @@ -54,7 +54,8 @@ const AnimatedScrollView: AnimatedComponentType< props.style != null ) { return ( - // $FlowFixMe - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied. + // $FlowFixMe[incompatible-type] - It should return an Animated ScrollView but it returns a ScrollView with Animated props applied. + // $FlowFixMe[incompatible-variance] { keyboardNeverPersistTaps && this._keyboardIsDismissible() && e.target != null && - // $FlowFixMe Error supressed during the migration of HostInstance to ReactNativeElement + // $FlowFixMe[incompatible-type] Error supressed during the migration of HostInstance to ReactNativeElement !TextInputState.isTextInput(e.target) ) { return true; diff --git a/packages/react-native/Libraries/Components/TextInput/TextInputState.js b/packages/react-native/Libraries/Components/TextInput/TextInputState.js index 4707e227002..9ef598defee 100644 --- a/packages/react-native/Libraries/Components/TextInput/TextInputState.js +++ b/packages/react-native/Libraries/Components/TextInput/TextInputState.js @@ -88,7 +88,7 @@ function focusTextInput(textField: ?HostInstance) { if (textField != null) { const fieldCanBeFocused = currentlyFocusedInputRef !== textField && - // $FlowFixMe - `currentProps` is missing in `NativeMethods` + // $FlowFixMe[prop-missing] - `currentProps` is missing in `NativeMethods` textField.currentProps?.editable !== false; if (!fieldCanBeFocused) { diff --git a/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js b/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js index b47a964e1d0..a33757e1e15 100644 --- a/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js +++ b/packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js @@ -123,7 +123,7 @@ jest.unmock('../TextInput'); throw new Error('Expected `textInputElement` to be non-null'); } - // $FlowFixMe + // $FlowFixMe[prop-missing] textInputElement.currentProps = textInputElement.props; expect(textInputElement.isFocused()).toBe(false); diff --git a/packages/react-native/Libraries/Image/Image.android.js b/packages/react-native/Libraries/Image/Image.android.js index b543c9f709d..0bf9936bed3 100644 --- a/packages/react-native/Libraries/Image/Image.android.js +++ b/packages/react-native/Libraries/Image/Image.android.js @@ -387,7 +387,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInImage()) { // in order to have a better alignment between platforms in the future. src: sources, source: sources, - /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found + /* $FlowFixMe[prop-missing](>=0.78.0 site=react_native_android_fb) This issue was found * when making Flow check .android.js files. */ headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}), defaultSource: defaultSource ? defaultSource.uri : null, diff --git a/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js b/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js index 18042946737..9a7efd0e236 100644 --- a/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js +++ b/packages/react-native/Libraries/Lists/__flowtests__/FlatList-flowtest.js @@ -36,7 +36,7 @@ export function testBadDataWithTypicalItem(): React.Node { key: 1, }, ]; - // $FlowExpectedError - bad title type 6, should be string + // $FlowExpectedError[incompatible-type] - bad title type 6, should be string return ; } @@ -46,7 +46,7 @@ export function testMissingFieldWithTypicalItem(): React.Node { key: 1, }, ]; - // $FlowExpectedError - missing title + // $FlowExpectedError[incompatible-type] - missing title return ; } @@ -62,7 +62,7 @@ export function testGoodDataWithBadCustomRenderItemFunction(): React.Node { renderItem={info => ( { - // $FlowExpectedError - bad widgetCount type 6, should be Object + // $FlowExpectedError[prop-missing] - bad widgetCount type 6, should be Object info.item.widget.missingProp } @@ -80,22 +80,26 @@ export function testBadRenderItemFunction(): $ReadOnlyArray { }, ]; return [ - // $FlowExpectedError - title should be inside `item` + // $FlowExpectedError[incompatible-type] - title should be inside `item` + // $FlowExpectedError[incompatible-exact] } data={data} />, } data={data} />, } - // $FlowExpectedError - bad title type number, should be string + // $FlowExpectedError[incompatible-type] - bad title type number, should be string data={data} />, // EverythingIsFine } data={data} />, @@ -104,11 +108,11 @@ export function testBadRenderItemFunction(): $ReadOnlyArray { export function testOtherBadProps(): $ReadOnlyArray { return [ - // $FlowExpectedError - bad numColumns type "lots" + // $FlowExpectedError[incompatible-type] - bad numColumns type "lots" , - // $FlowExpectedError - bad windowSize type "big" + // $FlowExpectedError[incompatible-type] - bad windowSize type "big" , - // $FlowExpectedError - missing `data` prop + // $FlowExpectedError[incompatible-type] - missing `data` prop , ]; } diff --git a/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js b/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js index f954e9e8b03..49345b0de80 100644 --- a/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js +++ b/packages/react-native/Libraries/Lists/__flowtests__/SectionList-flowtest.js @@ -55,12 +55,13 @@ export function testBadRenderItemFunction(): $ReadOnlyArray { ]; return [ } sections={sections} />, } sections={sections} />, @@ -78,14 +79,14 @@ export function testBadInheritedDefaultProp(): React.MixedElement { ); } export function testMissingData(): React.MixedElement { - // $FlowExpectedError - missing `sections` prop + // $FlowExpectedError[incompatible-type] - missing `sections` prop return ; } @@ -122,7 +123,7 @@ export function testBadSectionsMetadata(): React.MixedElement { diff --git a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js index c240e383e31..df6d96c04f5 100644 --- a/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +++ b/packages/react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js @@ -58,12 +58,12 @@ export default class ReactFabricHostComponent implements NativeMethods { } blur() { - // $FlowFixMe - Error supressed during the migration of HostInstance to ReactNativeElement + // $FlowFixMe[incompatible-type] - Error supressed during the migration of HostInstance to ReactNativeElement TextInputState.blurTextInput(this); } focus() { - // $FlowFixMe - Error supressed during the migration of HostInstance to ReactNativeElement + // $FlowFixMe[incompatible-type] - Error supressed during the migration of HostInstance to ReactNativeElement TextInputState.focusTextInput(this); } diff --git a/packages/react-native/Libraries/ReactNative/RendererImplementation.js b/packages/react-native/Libraries/ReactNative/RendererImplementation.js index 2814aa811be..770ac325093 100644 --- a/packages/react-native/Libraries/ReactNative/RendererImplementation.js +++ b/packages/react-native/Libraries/ReactNative/RendererImplementation.js @@ -47,14 +47,14 @@ const getMethod: (>( ) => ReactNativeType[MethodName]) = (getRenderer, methodName) => { let cachedImpl; - // $FlowExpectedError + // $FlowExpectedError[incompatible-type] return function (arg1, arg2, arg3, arg4, arg5, arg6) { if (cachedImpl == null) { - // $FlowExpectedError + // $FlowExpectedError[prop-missing] cachedImpl = getRenderer()[methodName]; } - // $FlowExpectedError + // $FlowExpectedError[extra-arg] return cachedImpl(arg1, arg2, arg3, arg4, arg5); }; }; diff --git a/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js b/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js index 9ec8c2efa3f..533fc11a9de 100644 --- a/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +++ b/packages/react-native/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js @@ -37,17 +37,17 @@ export function testGoodCompose() { } export function testBadCompose() { - // $FlowExpectedError - Incompatible type. + // $FlowExpectedError[incompatible-type] - Incompatible type. (StyleSheet.compose(textStyle, textStyle): ImageStyleProp); - // $FlowExpectedError - Incompatible type. + // $FlowExpectedError[incompatible-type] - Incompatible type. (StyleSheet.compose( // $FlowExpectedError - Incompatible type. [textStyle], null, ): ImageStyleProp); - // $FlowExpectedError - Incompatible type. + // $FlowExpectedError[incompatible-type] - Incompatible type. (StyleSheet.compose( Math.random() < 0.5 ? textStyle : null, null, diff --git a/packages/react-native/Libraries/StyleSheet/processFilter.js b/packages/react-native/Libraries/StyleSheet/processFilter.js index 465e90c80bc..3c15c1c9ada 100644 --- a/packages/react-native/Libraries/StyleSheet/processFilter.js +++ b/packages/react-native/Libraries/StyleSheet/processFilter.js @@ -69,9 +69,9 @@ export default function processFilter( if (amount != null) { const filterFunction = {}; - // $FlowFixMe The key will be the correct one but flow can't see that. + // $FlowFixMe[prop-missing] The key will be the correct one but flow can't see that. filterFunction[camelizedName] = amount; - // $FlowFixMe The key will be the correct one but flow can't see that. + // $FlowFixMe[incompatible-type] The key will be the correct one but flow can't see that. result.push(filterFunction); } else { // If any primitive is invalid then apply none of the filters. This is how @@ -85,7 +85,7 @@ export default function processFilter( for (const filterFunction of filter) { const [filterName, filterValue] = Object.entries(filterFunction)[0]; if (filterName === 'dropShadow') { - // $FlowFixMe + // $FlowFixMe[incompatible-type] const dropShadow = parseDropShadow(filterValue); if (dropShadow == null) { return []; @@ -96,9 +96,9 @@ export default function processFilter( if (amount != null) { const resultObject = {}; - // $FlowFixMe + // $FlowFixMe[prop-missing] resultObject[filterName] = amount; - // $FlowFixMe + // $FlowFixMe[incompatible-type] result.push(resultObject); } else { // If any primitive is invalid then apply none of the filters. This is how diff --git a/packages/react-native/Libraries/vendor/emitter/__tests__/EventEmitter-test.js b/packages/react-native/Libraries/vendor/emitter/__tests__/EventEmitter-test.js index 393ce4af4d4..4cb184d840e 100644 --- a/packages/react-native/Libraries/vendor/emitter/__tests__/EventEmitter-test.js +++ b/packages/react-native/Libraries/vendor/emitter/__tests__/EventEmitter-test.js @@ -106,27 +106,27 @@ describe('listeners', () => { }).not.toThrow(); expect(() => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-type] emitter.addListener('A', null); }).toThrow(); expect(() => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-type] emitter.addListener('A', undefined); }).toThrow(); expect(() => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-type] emitter.addListener('A', 'abc'); }).toThrow(); expect(() => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-type] emitter.addListener('A', 123); }).toThrow(); expect(() => { - // $FlowExpectedError + // $FlowExpectedError[incompatible-type] emitter.addListener('A', 123); }).toThrow(); }); diff --git a/packages/react-native/jest/mockNativeComponent.js b/packages/react-native/jest/mockNativeComponent.js index 824c0870db9..27eaa1e129d 100644 --- a/packages/react-native/jest/mockNativeComponent.js +++ b/packages/react-native/jest/mockNativeComponent.js @@ -47,6 +47,6 @@ export default function mockNativeComponent( Component.displayName = viewName; } - // $FlowFixMe - Error supressed during the migration of HostInstance to ReactNativeElement + // $FlowFixMe[incompatible-type] - Error supressed during the migration of HostInstance to ReactNativeElement return Component; } diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js index 71906a96d54..4430b7d66c2 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js @@ -1330,7 +1330,7 @@ function SetAccessibilityFocusExample(props: {}): React.Node { return ( - {/* $FlowFixMe[incompatible-type */} + {/* $FlowFixMe[incompatible-type] */} SetAccessibilityFocus on native element. This should get focus after clicking the button! diff --git a/packages/rn-tester/js/examples/DrawerLayoutAndroid/DrawerLayoutAndroidExample.js b/packages/rn-tester/js/examples/DrawerLayoutAndroid/DrawerLayoutAndroidExample.js index c0360008167..5e70b342aa4 100644 --- a/packages/rn-tester/js/examples/DrawerLayoutAndroid/DrawerLayoutAndroidExample.js +++ b/packages/rn-tester/js/examples/DrawerLayoutAndroid/DrawerLayoutAndroidExample.js @@ -40,7 +40,7 @@ const Drawer = () => { I'm in the Drawer!