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

@@ -4,9 +4,15 @@ export type SendPolicyOverride = "allow" | "deny";
export function normalizeSendPolicyOverride(raw?: string | null): SendPolicyOverride | undefined {
const value = raw?.trim().toLowerCase();
if (!value) return undefined;
if (value === "allow" || value === "on") return "allow";
if (value === "deny" || value === "off") return "deny";
if (!value) {
return undefined;
}
if (value === "allow" || value === "on") {
return "allow";
}
if (value === "deny" || value === "off") {
return "deny";
}
return undefined;
}
@@ -14,14 +20,22 @@ export function parseSendPolicyCommand(raw?: string): {
hasCommand: boolean;
mode?: SendPolicyOverride | "inherit";
} {
if (!raw) return { hasCommand: false };
if (!raw) {
return { hasCommand: false };
}
const trimmed = raw.trim();
if (!trimmed) return { hasCommand: false };
if (!trimmed) {
return { hasCommand: false };
}
const normalized = normalizeCommandBody(trimmed);
const match = normalized.match(/^\/send(?:\s+([a-zA-Z]+))?\s*$/i);
if (!match) return { hasCommand: false };
if (!match) {
return { hasCommand: false };
}
const token = match[1]?.trim().toLowerCase();
if (!token) return { hasCommand: true };
if (!token) {
return { hasCommand: true };
}
if (token === "inherit" || token === "default" || token === "reset") {
return { hasCommand: true, mode: "inherit" };
}