Turn on warnings for React Compiler ESLint rule #56751
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I propose that we enable the React Compiler ESLint rule to emit warnings so that we can spot problematic patterns when writing new code. Let's create #dev-temp-react-compiler to discuss warnings that pose problems or are otherwise hard to deal with.
React Compiler
I think that we should aim to enable React Compiler at some point, either on parts of the codebase or the whole project. Ryan reported mixed results when enabling it on TAG. The details of the Compiler rollout are still something to be discussed, however despite potential problems, in my opinion these two things are true:
The ESLint rule
Many parts of the app in their current state won't be optimized because they're breaking the rules of React. React Compiler is in RC but it's near stable. In the meantime, we can start addressing issues in our code to make the compiler more effective when enabled.
I propose that we enable the React Compiler ESLint rule to emit warnings so that we can spot problematic patterns when writing new code. Many of those might surprise us or be patterns that we've learned to accept, see my question about
useRef
from a couple of months ago for an example. To help with that, we can create #temp-dev-react-compiler channel to discuss warnings that pose problems.From the React Compiler docs:
List of warnings reported by the
react-hooks/react-compiler
rule