fix(cli): clear lint warnings
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user