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

@@ -57,7 +57,9 @@ const TELEGRAM_POLL_RESTART_POLICY = {
};
const isGetUpdatesConflict = (err: unknown) => {
if (!err || typeof err !== "object") return false;
if (!err || typeof err !== "object") {
return false;
}
const typed = err as {
error_code?: number;
errorCode?: number;
@@ -66,7 +68,9 @@ const isGetUpdatesConflict = (err: unknown) => {
message?: string;
};
const errorCode = typed.error_code ?? typed.errorCode;
if (errorCode !== 409) return false;
if (errorCode !== 409) {
return false;
}
const haystack = [typed.method, typed.description, typed.message]
.filter((value): value is string => typeof value === "string")
.join(" ")
@@ -85,9 +89,13 @@ const NETWORK_ERROR_SNIPPETS = [
];
const isNetworkRelatedError = (err: unknown) => {
if (!err) return false;
if (!err) {
return false;
}
const message = formatErrorMessage(err).toLowerCase();
if (!message) return false;
if (!message) {
return false;
}
return NETWORK_ERROR_SNIPPETS.some((snippet) => message.includes(snippet));
};
@@ -111,7 +119,9 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) {
accountId: account.accountId,
});
const persistUpdateId = async (updateId: number) => {
if (lastUpdateId !== null && updateId <= lastUpdateId) return;
if (lastUpdateId !== null && updateId <= lastUpdateId) {
return;
}
lastUpdateId = updateId;
try {
await writeTelegramUpdateOffset({
@@ -188,7 +198,9 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) {
try {
await sleepWithAbort(delayMs, opts.abortSignal);
} catch (sleepErr) {
if (opts.abortSignal?.aborted) return;
if (opts.abortSignal?.aborted) {
return;
}
throw sleepErr;
}
} finally {