[READ-ONLY] Mirror of https://github.com/bombshell-dev/tools. Internal CLI to standardize tooling across all Bombshell projects
0

Configure Feed

Select the types of activity you want to include in your feed.

oxlint json parse failure fallback (#37)

* oxlint json parse failure fallback

* changeset

authored by

Jacob Bolda and committed by
GitHub
(Jun 19, 2026, 12:29 PM -0500) 14e24a8e b0e4a9fb

+30 -18
+5
.changeset/fresh-suits-glow.md
··· 1 + --- 2 + "@bomb.sh/tools": patch 3 + --- 4 + 5 + In some failure or no-op cases, oxlint seems to return output which is not json-parseable even with --json passed. Log output directly in these instances.
+25 -18
src/commands/lint.ts
··· 25 25 const args = ['-c', oxlintConfig, '--format=json', ...targets]; 26 26 if (fix) args.push('--fix'); 27 27 const result = await x(local('oxlint'), args, { throwOnError: false }); 28 - const json = JSON.parse(result.stdout); 29 - return (json.diagnostics ?? []).map( 30 - (d: { 31 - message: string; 32 - code: string; 33 - severity: string; 34 - filename?: string; 35 - labels?: Array<{ span?: { line?: number; column?: number } }>; 36 - }) => ({ 37 - tool: 'oxlint' as const, 38 - level: d.severity === 'error' ? 'error' : 'warning', 39 - code: d.code ?? 'unknown', 40 - message: d.message, 41 - file: d.filename, 42 - line: d.labels?.[0]?.span?.line, 43 - column: d.labels?.[0]?.span?.column, 44 - }), 45 - ); 28 + try { 29 + const json = JSON.parse(result.stdout); 30 + return (json.diagnostics ?? []).map( 31 + (d: { 32 + message: string; 33 + code: string; 34 + severity: string; 35 + filename?: string; 36 + labels?: Array<{ span?: { line?: number; column?: number } }>; 37 + }) => ({ 38 + tool: 'oxlint' as const, 39 + level: d.severity === 'error' ? 'error' : 'warning', 40 + code: d.code ?? 'unknown', 41 + message: d.message, 42 + file: d.filename, 43 + line: d.labels?.[0]?.span?.line, 44 + column: d.labels?.[0]?.span?.column, 45 + }), 46 + ); 47 + } catch { 48 + // in some cases, failures or no-ops do not produce valid JSON 49 + // fallback to raw output rather than throwing an error 50 + console.log(result.stdout); 51 + return []; 52 + } 46 53 } 47 54 48 55 export async function runKnip(): Promise<Violation[]> {