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.
This commit is contained in:
4
index.ts
4
index.ts
@@ -219,6 +219,10 @@ function formatDiagnostics(result: unknown, limit = 20): string {
|
|||||||
4: "Hint",
|
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 shown = diags.slice(0, limit);
|
||||||
const formatted = shown
|
const formatted = shown
|
||||||
.map((d: any, i: number) => {
|
.map((d: any, i: number) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user