mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(cli): distinguish info vs warning severity in lint output
The lint command displayed info-level findings with the warning icon and counted them in the warning total, while JSON correctly reported severity as "info". Now info findings show a distinct icon (ℹ) and are counted separately in both human and JSON output. Reproducer: # Create a composition with a timed element missing class="clip" npx hyperframes lint # Was: "1 warning(s)" with ⚠ icon npx hyperframes lint --json # Was: severity: "info" but warningCount: 1 # Human and JSON output now agree
This commit is contained in:
@@ -3,11 +3,20 @@ import path from "node:path";
|
||||
import { lintHyperframeHtml } from "../src/lint/hyperframeLinter";
|
||||
import type { HyperframeLintResult } from "../src/lint/types";
|
||||
|
||||
function formatCounts(result: HyperframeLintResult): string {
|
||||
const parts = [`${result.warningCount} warning${result.warningCount === 1 ? "" : "s"}`];
|
||||
if (result.infoCount > 0) {
|
||||
parts.push(`${result.infoCount} info${result.infoCount === 1 ? "" : "s"}`);
|
||||
}
|
||||
return parts.join(", ");
|
||||
}
|
||||
|
||||
function formatHumanOutput(result: HyperframeLintResult, resolvedPath: string): string {
|
||||
const counts = result.ok
|
||||
? formatCounts(result)
|
||||
: `${result.errorCount} error${result.errorCount === 1 ? "" : "s"}, ${formatCounts(result)}`;
|
||||
const lines = [
|
||||
result.ok
|
||||
? `PASS ${resolvedPath} (${result.warningCount} warning${result.warningCount === 1 ? "" : "s"})`
|
||||
: `FAIL ${resolvedPath} (${result.errorCount} error${result.errorCount === 1 ? "" : "s"}, ${result.warningCount} warning${result.warningCount === 1 ? "" : "s"})`,
|
||||
result.ok ? `PASS ${resolvedPath} (${counts})` : `FAIL ${resolvedPath} (${counts})`,
|
||||
];
|
||||
|
||||
for (const finding of result.findings) {
|
||||
|
||||
Reference in New Issue
Block a user