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

@@ -68,9 +68,13 @@ async function promptWhatsAppAllowFrom(
initialValue: existingAllowFrom[0],
validate: (value) => {
const raw = String(value ?? "").trim();
if (!raw) return "Required";
if (!raw) {
return "Required";
}
const normalized = normalizeE164(raw);
if (!normalized) return `Invalid number: ${raw}`;
if (!normalized) {
return `Invalid number: ${raw}`;
}
return undefined;
},
});
@@ -126,9 +130,13 @@ async function promptWhatsAppAllowFrom(
initialValue: existingAllowFrom[0],
validate: (value) => {
const raw = String(value ?? "").trim();
if (!raw) return "Required";
if (!raw) {
return "Required";
}
const normalized = normalizeE164(raw);
if (!normalized) return `Invalid number: ${raw}`;
if (!normalized) {
return `Invalid number: ${raw}`;
}
return undefined;
},
});
@@ -170,7 +178,9 @@ async function promptWhatsAppAllowFrom(
if (policy === "open") {
next = setWhatsAppAllowFrom(next, ["*"]);
}
if (policy === "disabled") return next;
if (policy === "disabled") {
return next;
}
const allowOptions =
existingAllowFrom.length > 0
@@ -205,16 +215,24 @@ async function promptWhatsAppAllowFrom(
placeholder: "+15555550123, +447700900123",
validate: (value) => {
const raw = String(value ?? "").trim();
if (!raw) return "Required";
if (!raw) {
return "Required";
}
const parts = raw
.split(/[\n,;]+/g)
.map((p) => p.trim())
.filter(Boolean);
if (parts.length === 0) return "Required";
if (parts.length === 0) {
return "Required";
}
for (const part of parts) {
if (part === "*") continue;
if (part === "*") {
continue;
}
const normalized = normalizeE164(part);
if (!normalized) return `Invalid number: ${part}`;
if (!normalized) {
return `Invalid number: ${part}`;
}
}
return undefined;
},