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,19 +46,29 @@ export function isInternalMessageChannel(raw?: string | null): raw is InternalMe
export function isWebchatClient(client?: GatewayClientInfoLike | null): boolean {
const mode = normalizeGatewayClientMode(client?.mode);
if (mode === GATEWAY_CLIENT_MODES.WEBCHAT) return true;
if (mode === GATEWAY_CLIENT_MODES.WEBCHAT) {
return true;
}
return normalizeGatewayClientName(client?.id) === GATEWAY_CLIENT_NAMES.WEBCHAT_UI;
}
export function normalizeMessageChannel(raw?: string | null): string | undefined {
const normalized = raw?.trim().toLowerCase();
if (!normalized) return undefined;
if (normalized === INTERNAL_MESSAGE_CHANNEL) return INTERNAL_MESSAGE_CHANNEL;
if (!normalized) {
return undefined;
}
if (normalized === INTERNAL_MESSAGE_CHANNEL) {
return INTERNAL_MESSAGE_CHANNEL;
}
const builtIn = normalizeChatChannelId(normalized);
if (builtIn) return builtIn;
if (builtIn) {
return builtIn;
}
const registry = getActivePluginRegistry();
const pluginMatch = registry?.channels.find((entry) => {
if (entry.plugin.id.toLowerCase() === normalized) return true;
if (entry.plugin.id.toLowerCase() === normalized) {
return true;
}
return (entry.plugin.meta.aliases ?? []).some(
(alias) => alias.trim().toLowerCase() === normalized,
);
@@ -68,13 +78,17 @@ export function normalizeMessageChannel(raw?: string | null): string | undefined
const listPluginChannelIds = (): string[] => {
const registry = getActivePluginRegistry();
if (!registry) return [];
if (!registry) {
return [];
}
return registry.channels.map((entry) => entry.plugin.id);
};
const listPluginChannelAliases = (): string[] => {
const registry = getActivePluginRegistry();
if (!registry) return [];
if (!registry) {
return [];
}
return registry.channels.flatMap((entry) => entry.plugin.meta.aliases ?? []);
};
@@ -112,7 +126,9 @@ export function resolveGatewayMessageChannel(
raw?: string | null,
): GatewayMessageChannel | undefined {
const normalized = normalizeMessageChannel(raw);
if (!normalized) return undefined;
if (!normalized) {
return undefined;
}
return isGatewayMessageChannel(normalized) ? normalized : undefined;
}
@@ -125,6 +141,8 @@ export function resolveMessageChannel(
export function isMarkdownCapableMessageChannel(raw?: string | null): boolean {
const channel = normalizeMessageChannel(raw);
if (!channel) return false;
if (!channel) {
return false;
}
return MARKDOWN_CAPABLE_CHANNELS.has(channel);
}