fix(oxc): tolerate stdout notices ahead of oxlint's JSON payload#476
Merged
Conversation
Oxlint can print human-readable notices (e.g. "No files found to lint...") to stdout before the JSON payload even when run with `-f json` — this happens for any project where oxlint's default file discovery matches zero files (e.g. a package that isn't opted into oxlint in a monorepo with a default-deny root config). `parseOxlintOutput` called `JSON.parse` on the raw stdout, so that leading notice broke parsing and the lint-run RPC failed with "Oxlint returned invalid JSON" instead of reporting zero diagnostics.
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
yuyinws
approved these changes
Jul 26, 2026
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.
Summary
parseOxlintOutputcallsJSON.parsedirectly on oxlint's raw stdout. When oxlint's own file-discovery matches zero files (e.g. a package in a monorepo that isn't opted into oxlint, or any project with an empty/mismatched include glob), oxlint prints a human-readable notice —No files found to lint. Please check your paths and ignore patterns.— to stdout before the JSON payload, even when invoked with-f json. That leading line breaksJSON.parse, and thedevtools-oxc:run-lintRPC surfaces a genericOxlint returned invalid JSONerror instead of reporting a clean zero-diagnostics result.Reproduced directly:
Fix
parseOxlintOutputnow skips to the first{in stdout before parsing, so any leading notice oxlint prints doesn't break JSON parsing. Falls back to parsing the raw string unchanged if no{is found, preserving existing error behavior for genuinely invalid output.Test plan
pnpm vitest run packages/oxc/src/node/__tests__/lint-results.test.ts— 6/6 passing.pnpm -C packages/oxc run lint— clean.