From f811efef68e5f033be538b4331b0c5ce53e4393f Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Sat, 2 May 2026 20:24:35 -0400 Subject: [PATCH] fix(diagnostics): sort by severity before truncating Errors appear first, then warnings, info, hints. Ensures the most actionable issues survive the cap instead of being pushed out by low-priority hints. --- index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.ts b/index.ts index fd070f3..b8d8924 100644 --- a/index.ts +++ b/index.ts @@ -219,6 +219,10 @@ function formatDiagnostics(result: unknown, limit = 20): string { 4: "Hint", }; + // Sort By Severity - Errors first, then warnings, info, hints. Ensures + // the most actionable issues survive truncation. + diags.sort((a: any, b: any) => (a.severity ?? 99) - (b.severity ?? 99)); + const shown = diags.slice(0, limit); const formatted = shown .map((d: any, i: number) => {