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

@@ -45,10 +45,16 @@ const GOOGLE_SCHEMA_UNSUPPORTED_KEYWORDS = new Set([
const ANTIGRAVITY_SIGNATURE_RE = /^[A-Za-z0-9+/]+={0,2}$/;
function isValidAntigravitySignature(value: unknown): value is string {
if (typeof value !== "string") return false;
if (typeof value !== "string") {
return false;
}
const trimmed = value.trim();
if (!trimmed) return false;
if (trimmed.length % 4 !== 0) return false;
if (!trimmed) {
return false;
}
if (trimmed.length % 4 !== 0) {
return false;
}
return ANTIGRAVITY_SIGNATURE_RE.test(trimmed);
}
@@ -113,7 +119,9 @@ function sanitizeAntigravityThinkingBlocks(messages: AgentMessage[]): AgentMessa
}
function findUnsupportedSchemaKeywords(schema: unknown, path: string): string[] {
if (!schema || typeof schema !== "object") return [];
if (!schema || typeof schema !== "object") {
return [];
}
if (Array.isArray(schema)) {
return schema.flatMap((item, index) =>
findUnsupportedSchemaKeywords(item, `${path}[${index}]`),
@@ -131,7 +139,9 @@ function findUnsupportedSchemaKeywords(schema: unknown, path: string): string[]
}
}
for (const [key, value] of Object.entries(record)) {
if (key === "properties") continue;
if (key === "properties") {
continue;
}
if (GOOGLE_SCHEMA_UNSUPPORTED_KEYWORDS.has(key)) {
violations.push(`${path}.${key}`);
}
@@ -153,7 +163,9 @@ export function sanitizeToolsForGoogle<
return params.tools;
}
return params.tools.map((tool) => {
if (!tool.parameters || typeof tool.parameters !== "object") return tool;
if (!tool.parameters || typeof tool.parameters !== "object") {
return tool;
}
return {
...tool,
parameters: cleanToolSchemaForGemini(
@@ -206,7 +218,9 @@ export function onUnhandledCompactionFailure(cb: CompactionFailureListener): ()
registerUnhandledRejectionHandler((reason) => {
const message = describeUnknownError(reason);
if (!isCompactionFailureError(message)) return false;
if (!isCompactionFailureError(message)) {
return false;
}
log.error(`Auto-compaction failed (unhandled): ${message}`);
compactionFailureEmitter.emit("failure", message);
return true;
@@ -228,7 +242,9 @@ function readLastModelSnapshot(sessionManager: SessionManager): ModelSnapshotEnt
const entries = sessionManager.getEntries();
for (let i = entries.length - 1; i >= 0; i--) {
const entry = entries[i] as CustomEntryLike;
if (entry?.type !== "custom" || entry?.customType !== MODEL_SNAPSHOT_CUSTOM_TYPE) continue;
if (entry?.type !== "custom" || entry?.customType !== MODEL_SNAPSHOT_CUSTOM_TYPE) {
continue;
}
const data = entry?.data as ModelSnapshotEntry | undefined;
if (data && typeof data === "object") {
return data;