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

@@ -12,11 +12,15 @@ type OpenAIReasoningSignature = {
};
function parseOpenAIReasoningSignature(value: unknown): OpenAIReasoningSignature | null {
if (!value) return null;
if (!value) {
return null;
}
let candidate: { id?: unknown; type?: unknown } | null = null;
if (typeof value === "string") {
const trimmed = value.trim();
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) return null;
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
return null;
}
try {
candidate = JSON.parse(trimmed) as { id?: unknown; type?: unknown };
} catch {
@@ -25,10 +29,14 @@ function parseOpenAIReasoningSignature(value: unknown): OpenAIReasoningSignature
} else if (typeof value === "object") {
candidate = value as { id?: unknown; type?: unknown };
}
if (!candidate) return null;
if (!candidate) {
return null;
}
const id = typeof candidate.id === "string" ? candidate.id : "";
const type = typeof candidate.type === "string" ? candidate.type : "";
if (!id.startsWith("rs_")) return null;
if (!id.startsWith("rs_")) {
return null;
}
if (type === "reasoning" || type.startsWith("reasoning.")) {
return { id, type };
}
@@ -41,8 +49,12 @@ function hasFollowingNonThinkingBlock(
): boolean {
for (let i = index + 1; i < content.length; i++) {
const block = content[i];
if (!block || typeof block !== "object") return true;
if ((block as { type?: unknown }).type !== "thinking") return true;
if (!block || typeof block !== "object") {
return true;
}
if ((block as { type?: unknown }).type !== "thinking") {
return true;
}
}
return false;
}