From 4e4a0e6aeab1d40dc59fc40ac0bdcf7e47ff8b78 Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Sat, 13 Jun 2026 00:31:20 -0500 Subject: [PATCH 1/2] oxlint json parse failure fallback --- src/commands/lint.ts | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/commands/lint.ts b/src/commands/lint.ts index 8a6f73f..5cc0dba 100644 --- a/src/commands/lint.ts +++ b/src/commands/lint.ts @@ -25,24 +25,31 @@ export async function runOxlint(targets: string[], fix?: boolean): Promise; - }) => ({ - tool: 'oxlint' as const, - level: d.severity === 'error' ? 'error' : 'warning', - code: d.code ?? 'unknown', - message: d.message, - file: d.filename, - line: d.labels?.[0]?.span?.line, - column: d.labels?.[0]?.span?.column, - }), - ); + try { + const json = JSON.parse(result.stdout); + return (json.diagnostics ?? []).map( + (d: { + message: string; + code: string; + severity: string; + filename?: string; + labels?: Array<{ span?: { line?: number; column?: number } }>; + }) => ({ + tool: 'oxlint' as const, + level: d.severity === 'error' ? 'error' : 'warning', + code: d.code ?? 'unknown', + message: d.message, + file: d.filename, + line: d.labels?.[0]?.span?.line, + column: d.labels?.[0]?.span?.column, + }), + ); + } catch { + // in some cases, failures or no-ops do not produce valid JSON + // fallback to raw output rather than throwing an error + console.log(result.stdout); + return []; + } } export async function runKnip(): Promise { From acf272538a4934e1bded69c93627000764f6d62a Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Sat, 13 Jun 2026 00:38:13 -0500 Subject: [PATCH 2/2] changeset --- .changeset/fresh-suits-glow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fresh-suits-glow.md diff --git a/.changeset/fresh-suits-glow.md b/.changeset/fresh-suits-glow.md new file mode 100644 index 0000000..3f8dc5f --- /dev/null +++ b/.changeset/fresh-suits-glow.md @@ -0,0 +1,5 @@ +--- +"@bomb.sh/tools": patch +--- + +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.