mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
9c1f0c697d
Summary: ## Rationale Previously, the NativeModule spec parser would throw an error the first time it encountered an invalid Flow type. While this is ideal from a parsing standpoint, from a linting standpoint, however, we may want to display all errors that make the NativeModule spec invalid. ## Changes This diff extends the NativeModule spec parser to collect all parsing errors in an array. In the codegen, if after building the schema, any parsing errors were detected, we throw the first one. In the ESLint rule, if after building the schema, any parsing errors were detected, the plan is to display them all. ## Notes - All ParserErrors keep a track of the invalid AST Node - When a Parsing error occurs, the Parser tries its best to continue parsing the rest of the source. For function parameters, it'll move on to the next param. For object proroperties, it'll move to the next property. It'll form a half-baked schema in the process, when a parsing error occurs. However, higher up in the stack, we have a check that discards the half-baked schema, if any ParsingErrors were collected. Changelog: [Internal] Reviewed By: fkgozali Differential Revision: D24379511 fbshipit-source-id: 1989433da9b356b9ad5d9dcf901b429f585803c2