From 1ef035cd5acab6ed6bbd4800e69b395e397ee9c7 Mon Sep 17 00:00:00 2001 From: dvcolomban Date: Fri, 24 Jul 2026 19:20:08 +0200 Subject: [PATCH 1/2] fix(oxc): tolerate stdout notices ahead of oxlint's JSON payload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../src/node/__tests__/lint-results.test.ts | 18 ++++++++++++++++++ packages/oxc/src/node/utils/oxlint.ts | 9 ++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/oxc/src/node/__tests__/lint-results.test.ts b/packages/oxc/src/node/__tests__/lint-results.test.ts index e3152160b..1f6bfe29a 100644 --- a/packages/oxc/src/node/__tests__/lint-results.test.ts +++ b/packages/oxc/src/node/__tests__/lint-results.test.ts @@ -106,3 +106,21 @@ it('accepts the null rule count emitted by recent oxlint versions', async () => ), ).resolves.toMatchObject({ summary: { number_of_rules: null } }) }) + +it('skips the "no files found" notice oxlint prints to stdout ahead of the JSON payload', async () => { + const root = await createFixture() + const rawOutput = [ + 'No files found to lint. Please check your paths and ignore patterns.', + JSON.stringify({ + diagnostics: [], + number_of_files: 0, + number_of_rules: 95, + threads_count: 11, + start_time: 0.03, + }), + ].join('\n') + + await expect(parseOxlintOutput(rawOutput, root)).resolves.toMatchObject({ + summary: { number_of_files: 0 }, + }) +}) diff --git a/packages/oxc/src/node/utils/oxlint.ts b/packages/oxc/src/node/utils/oxlint.ts index 1d8b920b3..1bc6cca2f 100644 --- a/packages/oxc/src/node/utils/oxlint.ts +++ b/packages/oxc/src/node/utils/oxlint.ts @@ -41,7 +41,14 @@ export async function ensureOxcGitignored(root: string) { } export async function parseOxlintOutput(rawOutput: string, root: string) { - const data = JSON.parse(rawOutput) as Record + // Oxlint can print human-readable notices (e.g. "No files found to lint...") to stdout + // ahead of the JSON payload even in `-f json` mode. Skip to the first `{` so those notices + // don't break parsing. + const jsonStart = rawOutput.indexOf('{') + const data = JSON.parse(jsonStart === -1 ? rawOutput : rawOutput.slice(jsonStart)) as Record< + string, + unknown + > const summaryFields = [ 'number_of_files', 'number_of_rules', From 22550b0ab772d3e5c398741624285fd46fba50b9 Mon Sep 17 00:00:00 2001 From: yuyinws Date: Sun, 26 Jul 2026 09:30:37 +0800 Subject: [PATCH 2/2] fix(oxc): bridge RPC during local development --- packages/oxc/src/nuxt.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/oxc/src/nuxt.config.ts b/packages/oxc/src/nuxt.config.ts index 6808ca006..ae4f79a25 100644 --- a/packages/oxc/src/nuxt.config.ts +++ b/packages/oxc/src/nuxt.config.ts @@ -1,6 +1,8 @@ import { fileURLToPath } from 'node:url' +import { viteDevBridge } from 'devframe/helpers/vite' import { defineNuxtConfig } from 'nuxt/config' import { alias } from '../../../alias' +import { oxcDevframe } from './node/devframe' const BASE = '/__devtools-oxc/' @@ -56,6 +58,9 @@ export default defineNuxtConfig({ }, vite: { base: BASE, + plugins: [ + viteDevBridge({ ...oxcDevframe, basePath: '/' }, { base: BASE, devMiddleware: true }), + ], optimizeDeps: { include: ['modern-monaco', 'floating-vue'], },