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

@@ -33,7 +33,9 @@ type LogsCliOptions = {
};
function parsePositiveInt(value: string | undefined, fallback: number): number {
if (!value) return fallback;
if (!value) {
return fallback;
}
const parsed = Number.parseInt(value, 10);
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
}
@@ -58,10 +60,16 @@ async function fetchLogs(
}
function formatLogTimestamp(value?: string, mode: "pretty" | "plain" = "plain") {
if (!value) return "";
if (!value) {
return "";
}
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) return value;
if (mode === "pretty") return parsed.toISOString().slice(11, 19);
if (Number.isNaN(parsed.getTime())) {
return value;
}
if (mode === "pretty") {
return parsed.toISOString().slice(11, 19);
}
return parsed.toISOString();
}
@@ -73,7 +81,9 @@ function formatLogLine(
},
): string {
const parsed = parseLogLine(raw);
if (!parsed) return raw;
if (!parsed) {
return raw;
}
const label = parsed.subsystem ?? parsed.module ?? "";
const time = formatLogTimestamp(parsed.time, opts.pretty ? "pretty" : "plain");
const level = parsed.level ?? "";
@@ -162,8 +172,12 @@ function emitGatewayError(
return;
}
if (!errorLine(colorize(rich, theme.error, message))) return;
if (!errorLine(details.message)) return;
if (!errorLine(colorize(rich, theme.error, message))) {
return;
}
if (!errorLine(details.message)) {
return;
}
errorLine(colorize(rich, theme.muted, hint));
}
@@ -288,7 +302,9 @@ export function registerLogsCli(program: Command) {
: cursor;
first = false;
if (!opts.follow) return;
if (!opts.follow) {
return;
}
await delay(interval);
}
});