chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -18,7 +18,9 @@ const graphemeSegmenter =
: null;
function splitGraphemes(value: string): string[] {
if (!graphemeSegmenter) return Array.from(value);
if (!graphemeSegmenter) {
return Array.from(value);
}
try {
return Array.from(graphemeSegmenter.segment(value), (seg) => seg.segment);
} catch {
@@ -74,12 +76,20 @@ const LOBSTER_ASCII = [
export function formatCliBannerArt(options: BannerOptions = {}): string {
const rich = options.richTty ?? isRich();
if (!rich) return LOBSTER_ASCII.join("\n");
if (!rich) {
return LOBSTER_ASCII.join("\n");
}
const colorChar = (ch: string) => {
if (ch === "█") return theme.accentBright(ch);
if (ch === "░") return theme.accentDim(ch);
if (ch === "▀") return theme.accent(ch);
if (ch === "█") {
return theme.accentBright(ch);
}
if (ch === "░") {
return theme.accentDim(ch);
}
if (ch === "▀") {
return theme.accent(ch);
}
return theme.muted(ch);
};
@@ -99,11 +109,19 @@ export function formatCliBannerArt(options: BannerOptions = {}): string {
}
export function emitCliBanner(version: string, options: BannerOptions = {}) {
if (bannerEmitted) return;
if (bannerEmitted) {
return;
}
const argv = options.argv ?? process.argv;
if (!process.stdout.isTTY) return;
if (hasJsonFlag(argv)) return;
if (hasVersionFlag(argv)) return;
if (!process.stdout.isTTY) {
return;
}
if (hasJsonFlag(argv)) {
return;
}
if (hasVersionFlag(argv)) {
return;
}
const line = formatCliBannerLine(version, options);
process.stdout.write(`\n${line}\n\n`);
bannerEmitted = true;