mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
a74765eb0a
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39035 Changelog: [General][Fixed] Flow syntax errors in Codegen specs are no longer ignored. Instead of throwing errors like most parsers, the `flow-parser` package returns errors as part of the AST (along with a best-effort parse). It turns out that `react-native/codegen` ignores such errors and only detects a subset of them after the fact. Here we change the behaviour to immediately throwing a descriptive error message (containing the file name and a code frame). **This change is theoretically breaking** for any published packages that already contain broken Flow code (that somehow doesn't happen to affect the Codegen output today). Hopefully, anyone using Flow-flavoured RN Codegen is also typechecking with Flow and/or building with Metro (which would both flag the same errors), so the impact should be fairly contained. Reviewed By: huntie Differential Revision: D48385786 fbshipit-source-id: c7e1f5fb64a61fb0eb9e9f8f7501b43264c9626c
@react-native/codegen
Installation
yarn add --dev @react-native/codegen
Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like
Testing
To run the tests in this package, run the following commands from the React Native root folder:
yarnto install the dependencies. You just need to run this onceyarn jest packages/react-native-codegen.