printFindings

tcmts.cli.main.printFindings · #mv7yj5e3 · term · runs on the server

uses tcmts.cli.style.red, which uses node:util

An API report's findings, a line each with why it matters, breaking ones first; and what follows them.

import type { ApiReport } from "#codebase/tcmts/cli/releases";
import { LINTS } from "#codebase/tcmts/cli/semver_checks";
import { bold, dim, red, yellow } from "#codebase/tcmts/cli/style";

export function printFindings(report: ApiReport) {
  const tone = { major: red, minor: yellow, patch: dim };
  for (const f of report.findings) {
    const l = LINTS[f.lint];
    console.log(
      `\n  ${tone[l.level](l.level.padEnd(5))}  ${bold(f.path)} ${l.summary}${f.detail ? `: ${f.detail}` : ""}`,
    );
    console.log(dim(`         ${f.lint}: ${l.why}`));
  }
  if (report.following.length)
    console.log(
      dim(
        `\n  and ${report.following.length} definition(s) that follow those changes (${report.following.slice(0, 5).join(", ")}${report.following.length > 5 ? ", …" : ""})`,
      ),
    );
}

uses

used by