Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/oxc/src/node/__tests__/lint-results.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
})
})
9 changes: 8 additions & 1 deletion packages/oxc/src/node/utils/oxlint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>
// 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',
Expand Down
5 changes: 5 additions & 0 deletions packages/oxc/src/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -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/'

Expand Down Expand Up @@ -56,6 +58,9 @@ export default defineNuxtConfig({
},
vite: {
base: BASE,
plugins: [
viteDevBridge({ ...oxcDevframe, basePath: '/' }, { base: BASE, devMiddleware: true }),
],
optimizeDeps: {
include: ['modern-monaco', 'floating-vue'],
},
Expand Down
Loading