Skip to content

fix(react-compiler): clarify incompatible-library remediation (keep the rule)#951

Merged
rayhanadev merged 4 commits into
mainfrom
cursor/triage-950-1e05
Jun 25, 2026
Merged

fix(react-compiler): clarify incompatible-library remediation (keep the rule)#951
rayhanadev merged 4 commits into
mainfrom
cursor/triage-950-1e05

Conversation

@skoshx

@skoshx skoshx commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What

Reworked from the original "disable the rule" approach (per maintainer decision) to keep react-hooks-js/incompatible-library active but fix its misleading remediation copy.

The rule fires when the React Compiler can't memoize through a third-party hook (e.g. @tanstack/react-virtual's useVirtualizer) — the reporter's pain (#950) was the generic action "Rewrite the flagged code so the compiler can optimize it", which reads as "reimplement the library locally" and steers users off mature libraries.

The compiler's own bail-out reason is informative, so the rule stays on; only the action changes (in core/src/runners/oxlint/parse-output.ts) to: it's a limitation of the library, not a bug in your code — memoize any of its values you pass into other memoized components, or disable the rule if it's noise.

Changes

  • Restore incompatible-library in EXTERNAL_RULES (reverts the disable).
  • Add a per-rule remediation action in parse-output.ts + a react-compiler-bailout-message.test.ts case.
  • Replace the changeset.

Closes #950


Note

Low Risk
User-facing diagnostic text only in oxlint output parsing; no runtime behavior, security, or data-path changes.

Overview
Fixes misleading guidance for react-hooks-js/incompatible-library when oxlint/React Compiler flags third-party hooks (e.g. TanStack Virtual) that the compiler cannot memoize through.

The rule stays enabled; only the user-facing action changes. Instead of the generic "Rewrite the flagged code so the compiler can optimize it", diagnostics now explain that the limitation is expected library behavior, suggest memoizing values passed into other memoized components, and document react-doctor-disable-next-line for noise. buildReactCompilerMessage accepts a per-rule action; other compiler bail-outs still use the rewrite copy.

Adds a changeset (patch @react-doctor/core) and a unit test asserting the new copy and absence of the old rewrite wording.

Reviewed by Cursor Bugbot for commit 6b50e3f. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 2 commits June 24, 2026 02:35
The react-hooks-js/incompatible-library rule from React Compiler is overly
aggressive and flags well-designed, battle-tested libraries like
@tanstack/react-virtual, @tanstack/react-table, and similar TanStack libraries.

These libraries are specifically designed to work with React and don't present
the compatibility issues the rule is trying to catch. The current remediation
guidance can push users away from mature virtualization/data libraries toward
fragile, handwritten implementations.

This change removes react-hooks-js/incompatible-library from EXTERNAL_RULES,
preventing it from being enabled in the oxlint config.

Closes #950

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 6b50e3f

…p the rule

Instead of disabling react-hooks-js/incompatible-library, keep the rule (its
compiler bail-out reason is informative) and replace the generic "rewrite the
flagged code" action — which read as "reimplement the library" and steered users
off mature libraries like @tanstack/react-virtual (#950) — with one that names
the real fix: it's a library limitation, not a bug; memoize values you pass into
other memoized components, or disable the rule if it's noise.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rayhanadev rayhanadev changed the title fix: disable react-hooks-js/incompatible-library rule fix(react-compiler): clarify incompatible-library remediation (keep the rule) Jun 25, 2026
…ine-disable

Tighten the remediation per the writing guidelines and point at the inline
suppression: "It's how the library works, not a bug in your code. Memoize values
you pass from it into other memoized components, or suppress it with
`// react-doctor-disable-next-line react-hooks-js/incompatible-library`."

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rayhanadev rayhanadev marked this pull request as ready for review June 25, 2026 20:15

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@rayhanadev rayhanadev merged commit c16e8ea into main Jun 25, 2026
30 checks passed
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.

react-hooks-js/incompatible-library flags @tanstack/react-virtual useVirtualizer

3 participants