react-native-macos/packages/eslint-plugin-codegen
Ramanpreet Nara 1de76d2842 Rename the `guard` utility to `tryParse`
Summary:
## What is `guard`?
`guard` accepts some JavaScript function that can throw a ParserError. If a ParserError is thrown by that JavaScript function, it captures and pushes the error to some global array, and returns null. If no ParserError is thrown, it simply returns the return value of the JavaScript function. This utility is used in the NativeModule spec parser to help it continue parsing even after it detects errors. Why do we want to do this? In the NativeModule spec linter, we want to display all these ParserErrors via ESLint.

## Changes
This diff renames `guard` to `tryParse` because `tryParse` more appropriately captures the intent/function of this utility: the work passed to it "tries" to parse some Flow types. A name like "guard" is a bit more ambiguous: What is it guarding against? What is the work doing? ¯\_(ツ)_/¯

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D25156185

fbshipit-source-id: 516647770579daa8613dbd67535074823f1aa848
2020-12-04 14:21:52 -08:00
..
__tests__ Move TurboModuleRegistry validation into NativeModule Spec Parser 2020-12-04 14:21:52 -08:00
with-babel-register Use custom require hook to strip Flow types from NativeModule spec parser 2020-10-27 00:41:47 -07:00
BUCK Open source react-native-modules ESLint rule 2020-09-22 11:32:37 -07:00
index.js Open source react-native-modules ESLint rule 2020-09-22 11:32:37 -07:00
package.json Use custom require hook to strip Flow types from NativeModule spec parser 2020-10-27 00:41:47 -07:00
react-native-modules.js Rename the `guard` utility to `tryParse` 2020-12-04 14:21:52 -08:00