fix(cli): clear lint warnings

This commit is contained in:
Peter Steinberger
2026-01-09 08:51:22 +01:00
parent 0a31112fb4
commit 7ed53e243d
2 changed files with 24 additions and 2 deletions

View File

@@ -10,6 +10,20 @@ type BannerOptions = TaglineOptions & {
let bannerEmitted = false;
const graphemeSegmenter =
typeof Intl !== "undefined" && "Segmenter" in Intl
? new Intl.Segmenter(undefined, { granularity: "grapheme" })
: null;
function splitGraphemes(value: string): string[] {
if (!graphemeSegmenter) return Array.from(value);
try {
return Array.from(graphemeSegmenter.segment(value), (seg) => seg.segment);
} catch {
return Array.from(value);
}
}
const hasJsonFlag = (argv: string[]) =>
argv.some((arg) => arg === "--json" || arg.startsWith("--json="));
@@ -62,7 +76,7 @@ export function formatCliBannerArt(options: BannerOptions = {}): string {
theme.accent("🦞")
);
}
return [...line].map(colorChar).join("");
return splitGraphemes(line).map(colorChar).join("");
});
return colored.join("\n");