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:
Miguel Ángel
2026-03-30 18:29:47 +02:00
parent 8bc99ebd9d
commit 5f731892f1
2 changed files with 27 additions and 5 deletions
@@ -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) {