mirror of
https://github.com/facebook/react.git
synced 2026-02-26 01:35:00 +00:00
--- Changed `panicOnBailout: boolean` to `panicThreshold`, which has the following options. Note that `ALL_ERRORS` corresponds to `panicOnBailout = true` and `CRITICAL_ERRORS` corresponds to `panicOnBailout = false`. `NONE` is a new option. ```js export type PanicThresholdOptions = // Bail out of compilation on all errors by throwing an exception. | "ALL_ERRORS" // Bail out of compilation only on critical or unrecognized errors. // Instead, silently skip the erroring function. | "CRITICAL_ERRORS" // Never bail out of compilation. Instead, silently skip the erroring // function or file. | "NONE"; ``` Jest seems to run babel through a different pipeline than Metro and - (perhaps through its complex `require` interjection logic). When running jest tests, exceptions thrown by babel transforms will bubble up to the nearest exception boundary which is often the jest test itself. This may not be a useful signal to anyone running a jest test with Forget enabled, as the erroring code may be within Forget itself or a transitively required module. Another reason to immediately bailing out on critical errors is that we may want to record errors found in the rest of the file. --- I'm not convinced that this change makes sense. A counterargument is that any CriticalErrors *should* be reported as parse errors, regardless of the runtime mode. Anyhow, this would be useful long term for our static analysis scripts (e.g. collecting info on bailouts and compilation info e.g. # slots used for JSX) as we want to compile-as-much-as-possible in those.
eslint-plugin-react-forget
ESLint plugin for React Forget
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-react-forget:
npm install eslint-plugin-react-forget --save-dev
Usage
Add react-forget to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"react-forget"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"react-forget/rule-name": 2
}
}
Rules
TODO: Run eslint-doc-generator to generate the rules list.