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

@@ -46,8 +46,12 @@ function listSetupTokenProfiles(store: {
}): string[] {
return Object.entries(store.profiles)
.filter(([, cred]) => {
if (cred.type !== "token") return false;
if (normalizeProviderId(cred.provider) !== "anthropic") return false;
if (cred.type !== "token") {
return false;
}
if (normalizeProviderId(cred.provider) !== "anthropic") {
return false;
}
return isSetupToken(cred.token);
})
.map(([id]) => id);
@@ -56,7 +60,9 @@ function listSetupTokenProfiles(store: {
function pickSetupTokenProfile(candidates: string[]): string {
const preferred = ["anthropic:setup-token-test", "anthropic:setup-token", "anthropic:default"];
for (const id of preferred) {
if (candidates.includes(id)) return id;
if (candidates.includes(id)) {
return id;
}
}
return candidates[0] ?? "";
}
@@ -124,7 +130,9 @@ function pickModel(models: Array<Model<Api>>, raw?: string): Model<Api> | null {
const normalized = raw?.trim() ?? "";
if (normalized) {
const parsed = parseModelRef(normalized, "anthropic");
if (!parsed) return null;
if (!parsed) {
return null;
}
return (
models.find(
(model) =>
@@ -141,7 +149,9 @@ function pickModel(models: Array<Model<Api>>, raw?: string): Model<Api> | null {
];
for (const id of preferred) {
const match = models.find((model) => model.id === id);
if (match) return match;
if (match) {
return match;
}
}
return models[0] ?? null;
}