Skip to content

fix: detect React Compiler in babel config files and package.json babel field - #1449

Draft
skoshx wants to merge 1 commit into
mainfrom
cursor/triage-1448-2dc5
Draft

fix: detect React Compiler in babel config files and package.json babel field#1449
skoshx wants to merge 1 commit into
mainfrom
cursor/triage-1448-2dc5

Conversation

@skoshx

@skoshx skoshx commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Root Cause

The React Compiler detection was failing for projects using babel-plugin-react-compiler in:

  • package.json babel field
  • babel config files (.babelrc, babel.config.js, etc.)

This caused React Compiler-gated rules like context-provider-value-from-unmemoized-local-literal to incorrectly fire even when React Compiler was enabled.

The bug was in packages/core/src/project-info/detectors.ts:

  • hasCompilerInConfigFile used allowCompilerTransform: false
  • hasCompilerInPackageJsonConfig used allowCompilerTransform: false

When 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

  • Added unit test for package.json babel config detection
  • Verified fix works with manual testing
  • All existing tests pass

Note

Full rde parity run recommended before merge to validate no cross-repo regressions, though the fix is very targeted and low-risk.

Closes #1448

Open in Web Open in Cursor 

…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>
@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1449
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1449
npm i https://pkg.pr.new/react-doctor@1449

commit: 49aad46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not fixed: context-provider-value-from-unmemoized-local-literal triggers even with React Compiler enabled

2 participants