mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
We currently have multiple flags for targeting which functions to compile, but they are actually mutually exclusive. This PR consolidates to a single `compilationMode: 'annotation' | 'infer' | 'all'` flag: * Annotation compiles only functions that explicitly opt-in with "use forget" * Infer compiles explicitly opted-in functions (via "use forget") as well as any known/inferred components or hooks: * Component declarations * Component or hook-like functions (same rules as the ESLint plugin but with an extra check for whether it uses JSX or calls a hook) * All compiles all top-level functions. We should get rid of this in a follow-up and make tests use infer mode by default, and add explicit opt-ins where necessary. In all modes, "use no forget" always takes precedence and can be used to opt-out. The default mode is now "infer".