Files
react-native/.flowconfig
Tim Yung f53f6137e6 RN: Migrate View to Component Syntax (#52018)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52018

Migrates `View` to use Flow's [Component Syntax](https://flow.org/en/docs/react/component-syntax/).

Component Syntax offers more concise syntax for expressing component definitions and eliminates the need for `View` to be cast as a component type. Component types improve type safety by more accurately modeling `ref` as props and enabling the use of modern type utilities such as `React.PropsOf<Component>` and `React.RefOf<Component>`.

This represents the first introduction of Component Syntax in the open source React Native repository, which is lowered to standard JavaScript through the use of [`hermes-parser`](https://www.npmjs.com/package/hermes-parser) and the following supporting packages:

- [`babel-plugin-syntax-hermes-parser`](https://www.npmjs.com/package/babel-plugin-syntax-hermes-parser)
- [`hermes-eslint`](https://www.npmjs.com/package/hermes-eslint)
- [`prettier-plugin-hermes-parser`](https://www.npmjs.com/package/prettier-plugin-hermes-parser)

By default, [`react-native/babel-preset`](https://www.npmjs.com/package/react-native/babel-preset) already provides configuration for `babel-plugin-syntax-hermes-parser`.

Although this is the first usage of Component Syntax, there are already Flow syntax features used in React Native that have required `hermes-parser` (e.g. [type casting expressions](https://flow.org/en/docs/types/casting/), [type guards](https://flow.org/en/docs/types/type-guards/), [const expressions](https://flow.org/en/docs/types/const-expression/)). As such, we do not anticipate this to introduce new build configuration problems for developers.

Changelog:
[Internal]

Reviewed By: javache, NickGerleman

Differential Revision: D76632879

fbshipit-source-id: e0a83dfc2e2014933000083de1825a311faad707
2025-06-16 06:52:07 -07:00

107 lines
2.4 KiB
Plaintext

[ignore]
; Ignore build cache folder
<PROJECT_ROOT>/packages/react-native/sdks/.*
; Ignore fb_internal modules
<PROJECT_ROOT>/packages/react-native/src/fb_internal/.*
; Ignore the codegen e2e tests
<PROJECT_ROOT>/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js
; Ignore the Dangerfile
<PROJECT_ROOT>/private/react-native-bots/dangerfile.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore other platform suffixes
.*\.macos\.js$
.*\.windows\.js$
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
; Checked-in build output
<PROJECT_ROOT>/packages/debugger-frontend/dist/
; Generated build output
<PROJECT_ROOT>/packages/.*/dist
; helloworld
<PROJECT_ROOT>/private/helloworld/ios/Pods/
; Ignore rn-tester Pods
<PROJECT_ROOT>/packages/rn-tester/Pods/
[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
[include]
[declarations]
.*/node_modules/.*
[libs]
flow-typed/
packages/react-native/interface.js
packages/react-native/flow/
[options]
enums=true
casting_syntax=both
component_syntax=true
emoji=true
exact_by_default=true
format.bracket_spacing=false
module.file_ext=.js
module.file_ext=.json
experimental.multi_platform=true
experimental.multi_platform.extensions=.ios
experimental.multi_platform.extensions=.android
munge_underscores=true
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/packages/react-native/index.js'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/packages/react-native/\1'
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/packages/dev-middleware'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'
module.system.haste.module_ref_prefix=m#
react.runtime=automatic
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FlowFixMeEmpty
ban_spread_key_props=true
[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=error
unsafe-getters-setters=warn
unnecessary-invariant=warn
unused-promise=error
[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import
[version]
^0.273.1