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

@@ -8,7 +8,9 @@ import type { TemplateContext } from "../templating.js";
function extractGroupId(raw: string | undefined | null): string | undefined {
const trimmed = (raw ?? "").trim();
if (!trimmed) return undefined;
if (!trimmed) {
return undefined;
}
const parts = trimmed.split(":").filter(Boolean);
if (parts.length >= 3 && (parts[1] === "group" || parts[1] === "channel")) {
return parts.slice(2).join(":") || undefined;
@@ -34,7 +36,9 @@ export function resolveGroupRequireMention(params: {
const { cfg, ctx, groupResolution } = params;
const rawChannel = groupResolution?.channel ?? ctx.Provider?.trim();
const channel = normalizeChannelId(rawChannel);
if (!channel) return true;
if (!channel) {
return true;
}
const groupId = groupResolution?.id ?? extractGroupId(ctx.From);
const groupChannel = ctx.GroupChannel?.trim() ?? ctx.GroupSubject?.trim();
const groupSpace = ctx.GroupSpace?.trim();
@@ -45,7 +49,9 @@ export function resolveGroupRequireMention(params: {
groupSpace,
accountId: ctx.AccountId,
});
if (typeof requireMention === "boolean") return requireMention;
if (typeof requireMention === "boolean") {
return requireMention;
}
return true;
}
@@ -68,9 +74,15 @@ export function buildGroupIntro(params: {
const providerKey = rawProvider?.toLowerCase() ?? "";
const providerId = normalizeChannelId(rawProvider);
const providerLabel = (() => {
if (!providerKey) return "chat";
if (isInternalMessageChannel(providerKey)) return "WebChat";
if (providerId) return getChannelPlugin(providerId)?.meta.label ?? providerId;
if (!providerKey) {
return "chat";
}
if (isInternalMessageChannel(providerKey)) {
return "WebChat";
}
if (providerId) {
return getChannelPlugin(providerId)?.meta.label ?? providerId;
}
return `${providerKey.at(0)?.toUpperCase() ?? ""}${providerKey.slice(1)}`;
})();
const subjectLine = subject