fix: detect React Compiler in babel config files and package.json babel field - #1449
Draft
skoshx wants to merge 1 commit into
Draft
fix: detect React Compiler in babel config files and package.json babel field#1449skoshx wants to merge 1 commit into
skoshx wants to merge 1 commit into
Conversation
…el field The React Compiler detection was failing for projects using: - babel-plugin-react-compiler in package.json babel field - babel-plugin-react-compiler in babel config files without the runtime package Root cause: The parameter was set to when analyzing babel configurations, preventing detection of the "babel-plugin-react-compiler" string literal. This caused and other React Compiler-gated rules to incorrectly fire even when React Compiler was enabled. Fix: Set for both and so the "babel-plugin-react-compiler" string literal is properly detected. Fixes #1448 Co-authored-by: Skosh <skoshx@users.noreply.github.com>
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Root Cause
The React Compiler detection was failing for projects using
babel-plugin-react-compilerin:babelfieldThis caused React Compiler-gated rules like
context-provider-value-from-unmemoized-local-literalto incorrectly fire even when React Compiler was enabled.The bug was in
packages/core/src/project-info/detectors.ts:hasCompilerInConfigFileusedallowCompilerTransform: falsehasCompilerInPackageJsonConfigusedallowCompilerTransform: falseWhen
allowCompilerTransform: false, the code at line 1512 won't detect the string literals"babel-plugin-react-compiler"or"react-compiler".Fix
Changed both functions to use
allowCompilerTransform: true, enabling proper detection of the babel plugin in configuration files.Testing
Note
Full
rde parityrun recommended before merge to validate no cross-repo regressions, though the fix is very targeted and low-risk.Closes #1448