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

@@ -28,9 +28,13 @@ function requireSessionKey(key?: string | null): string {
}
function normalizeContextKey(key?: string | null): string | null {
if (!key) return null;
if (!key) {
return null;
}
const trimmed = key.trim();
if (!trimmed) return null;
if (!trimmed) {
return null;
}
return trimmed.toLowerCase();
}
@@ -58,18 +62,26 @@ export function enqueueSystemEvent(text: string, options: SystemEventOptions) {
return created;
})();
const cleaned = text.trim();
if (!cleaned) return;
if (!cleaned) {
return;
}
entry.lastContextKey = normalizeContextKey(options?.contextKey);
if (entry.lastText === cleaned) return; // skip consecutive duplicates
if (entry.lastText === cleaned) {
return;
} // skip consecutive duplicates
entry.lastText = cleaned;
entry.queue.push({ text: cleaned, ts: Date.now() });
if (entry.queue.length > MAX_EVENTS) entry.queue.shift();
if (entry.queue.length > MAX_EVENTS) {
entry.queue.shift();
}
}
export function drainSystemEventEntries(sessionKey: string): SystemEvent[] {
const key = requireSessionKey(sessionKey);
const entry = queues.get(key);
if (!entry || entry.queue.length === 0) return [];
if (!entry || entry.queue.length === 0) {
return [];
}
const out = entry.queue.slice();
entry.queue.length = 0;
entry.lastText = null;