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

@@ -6,7 +6,9 @@ const getGroupSurfaces = () => new Set<string>([...listDeliverableMessageChannel
function normalizeGroupLabel(raw?: string) {
const trimmed = raw?.trim().toLowerCase() ?? "";
if (!trimmed) return "";
if (!trimmed) {
return "";
}
const dashed = trimmed.replace(/\s+/g, "-");
const cleaned = dashed.replace(/[^a-z0-9#@._+-]+/g, "-");
return cleaned.replace(/-{2,}/g, "-").replace(/^[-.]+|[-.]+$/g, "");
@@ -14,8 +16,12 @@ function normalizeGroupLabel(raw?: string) {
function shortenGroupId(value?: string) {
const trimmed = value?.trim() ?? "";
if (!trimmed) return "";
if (trimmed.length <= 14) return trimmed;
if (!trimmed) {
return "";
}
if (trimmed.length <= 14) {
return trimmed;
}
return `${trimmed.slice(0, 6)}...${trimmed.slice(-4)}`;
}
@@ -63,7 +69,9 @@ export function resolveGroupSessionKey(ctx: MsgContext): GroupKeyResolution | nu
from.includes(":group:") ||
from.includes(":channel:") ||
isWhatsAppGroupId;
if (!looksLikeGroup) return null;
if (!looksLikeGroup) {
return null;
}
const providerHint = ctx.Provider?.trim().toLowerCase();
@@ -74,7 +82,9 @@ export function resolveGroupSessionKey(ctx: MsgContext): GroupKeyResolution | nu
const provider = headIsSurface
? head
: (providerHint ?? (isWhatsAppGroupId ? "whatsapp" : undefined));
if (!provider) return null;
if (!provider) {
return null;
}
const second = parts[1]?.trim().toLowerCase();
const secondIsKind = second === "group" || second === "channel";
@@ -89,7 +99,9 @@ export function resolveGroupSessionKey(ctx: MsgContext): GroupKeyResolution | nu
: parts.slice(1).join(":")
: from;
const finalId = id.trim().toLowerCase();
if (!finalId) return null;
if (!finalId) {
return null;
}
return {
key: `${provider}:${kind}:${finalId}`,