fix(scan): degrade gracefully when react-hooks-js plugin fails to load - #848
Merged
Conversation
A broken/unimportable eslint-plugin-react-hooks made oxlint fail the entire config load, which dropped every curated react-doctor diagnostic (skippedChecks: ["lint"], zero results). The multi-line oxlint error was also truncated to 200 chars, cutting the plugin path mid-string — often at `…/node_modules/` — so it read as react-doctor passing an invalid directory rather than a plugin that failed to import (issue #833). Retry the scan once with the optional react-hooks-js plugin stripped so the curated rules, dead-code, and environment checks still run; the React Compiler rules are the only casualty, surfaced as a clear `lint:partial` note carrying oxlint's real underlying reason. Bump the unparseable-output preview 200 -> 600 so the full path and the `Error:` line survive instead of being cut at `…/node_modules/`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
commit: |
Contributor
|
No React Doctor issues found. 🎉 Reviewed by React Doctor for commit |
This was referenced Jun 16, 2026
Merged
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.
Why
Fixes #833. When the optional
react-hooks-js(React Compiler) plugin can't be imported in a user's environment, oxlint fails the entire config load — which dropped every curated react-doctor diagnostic too, leaving the scan withskippedChecks: ["lint"]and zero results. The oxlint error is multi-line, and the 200-char error preview truncated its plugin path mid-string (often right at…/node_modules/), so it read as react-doctor passing an invalid directory rather than a plugin that failed to load.The reported "invalid directory path ending in
/node_modules/" is therefore a truncation artifact — react-doctor resolves and passes the correct absolute entry file (verified across isolated/hoisted/workspace pnpm layouts); the realError:reason was discarded by the 200-char slice.Before:
After (verified via the
diagnose()API against a project with a deliberately-brokeneslint-plugin-react-hooks):What changed
run-oxlint.ts+runners/oxlint/config.ts): detect areact-hooks-jsplugin-load failure and retry once with that plugin + its compiler rules stripped (new internaldisableReactHooksJsPluginoption), mirroring the existing adopted-extendsfallback. Curated rules, dead-code, and environment checks all still run; the only casualty is the React Compiler rules, surfaced as a clearlint:partialnote that includes oxlint's real underlying reason. Reported only after the retry succeeds, so a still-failing scan surfaces the original error untouched.constants.ts): bumpedERROR_PREVIEW_LENGTH_CHARS200 → 600 so the full plugin path and the underlyingError:line survive instead of being cut at…/node_modules/.Test plan
pnpm --filter @react-doctor/core test— 11 new tests (config drop + note detection) pass; full core suite green except 2 pre-existingcheck-*-env-filefailures unrelated to this change (confirmed on the base tree).pnpm --filter @react-doctor/core typecheck,react-doctor+@react-doctor/apitypecheck — pass.pnpm lint— exit 0;vp fmt --check— clean.diagnose()against a pnpm project with a brokeneslint-plugin-react-hooks→ok: true, curated rules run,lint:partialnote present (output above).Note
Low Risk
Targeted oxlint fallback and error-preview sizing in the lint runner; behavior change is narrower scans (no compiler rules) instead of total lint failure, with tests covering detection and config.
Overview
Fixes #833 when a broken
eslint-plugin-react-hooksinstall used for optional React Compiler (react-hooks-js) rules would make oxlint reject the entire config, skipping all curated react-doctor lint and leavingskippedChecks: ["lint"].The oxlint runner now detects that specific JS-plugin load failure (
reactHooksJsPluginDropNoteonOxlintOutputUnparseableoutput), retries once withdisableReactHooksJsPluginso only compiler rules are omitted, and surfaces alint:partialnote viaonPartialFailure(including oxlint’sError:line when present). The adopted-extendsretry path is unchanged but uses the samebuildConfigoverride shape.Error previews for unparseable oxlint stdout grow from 200 → 600 characters so deep pnpm paths and the real failure reason are not truncated at
…/node_modules/.Tests cover config stripping and note detection; changeset bumps
@react-doctor/coreandreact-doctoras patch.Reviewed by Cursor Bugbot for commit 7266dcd. Bugbot is set up for automated code reviews on this repo. Configure here.