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

@@ -10,7 +10,9 @@ export type ChatAbortControllerEntry = {
export function isChatStopCommandText(text: string): boolean {
const trimmed = text.trim();
if (!trimmed) return false;
if (!trimmed) {
return false;
}
return trimmed.toLowerCase() === "/stop" || isAbortTrigger(trimmed);
}
@@ -74,8 +76,12 @@ export function abortChatRunById(
): { aborted: boolean } {
const { runId, sessionKey, stopReason } = params;
const active = ops.chatAbortControllers.get(runId);
if (!active) return { aborted: false };
if (active.sessionKey !== sessionKey) return { aborted: false };
if (!active) {
return { aborted: false };
}
if (active.sessionKey !== sessionKey) {
return { aborted: false };
}
ops.chatAbortedRuns.set(runId, Date.now());
active.controller.abort();
@@ -97,9 +103,13 @@ export function abortChatRunsForSessionKey(
const { sessionKey, stopReason } = params;
const runIds: string[] = [];
for (const [runId, active] of ops.chatAbortControllers) {
if (active.sessionKey !== sessionKey) continue;
if (active.sessionKey !== sessionKey) {
continue;
}
const res = abortChatRunById(ops, { runId, sessionKey, stopReason });
if (res.aborted) runIds.push(runId);
if (res.aborted) {
runIds.push(runId);
}
}
return { aborted: runIds.length > 0, runIds };
}