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

@@ -157,7 +157,9 @@ const DOCKS: Record<ChatChannelId, ChannelDock> = {
mentions: {
stripPatterns: ({ ctx }) => {
const selfE164 = (ctx.To ?? "").replace(/^whatsapp:/, "");
if (!selfE164) return [];
if (!selfE164) {
return [];
}
const escaped = escapeRegExp(selfE164);
return [escaped, `@${escaped}`];
},
@@ -403,9 +405,13 @@ function listPluginDockEntries(): Array<{ id: ChannelId; dock: ChannelDock; orde
for (const entry of registry.channels) {
const plugin = entry.plugin;
const id = String(plugin.id).trim();
if (!id || seen.has(id)) continue;
if (!id || seen.has(id)) {
continue;
}
seen.add(id);
if (CHAT_CHANNEL_ORDER.includes(plugin.id as ChatChannelId)) continue;
if (CHAT_CHANNEL_ORDER.includes(plugin.id as ChatChannelId)) {
continue;
}
const dock = entry.dock ?? buildDockFromPlugin(plugin);
entries.push({ id: plugin.id, dock, order: plugin.meta.order });
}
@@ -425,7 +431,9 @@ export function listChannelDocks(): ChannelDock[] {
const indexB = CHAT_CHANNEL_ORDER.indexOf(b.id as ChatChannelId);
const orderA = a.order ?? (indexA === -1 ? 999 : indexA);
const orderB = b.order ?? (indexB === -1 ? 999 : indexB);
if (orderA !== orderB) return orderA - orderB;
if (orderA !== orderB) {
return orderA - orderB;
}
return String(a.id).localeCompare(String(b.id));
});
return combined.map((entry) => entry.dock);
@@ -433,9 +441,13 @@ export function listChannelDocks(): ChannelDock[] {
export function getChannelDock(id: ChannelId): ChannelDock | undefined {
const core = DOCKS[id as ChatChannelId];
if (core) return core;
if (core) {
return core;
}
const registry = requireActivePluginRegistry();
const pluginEntry = registry.channels.find((entry) => entry.plugin.id === id);
if (!pluginEntry) return undefined;
if (!pluginEntry) {
return undefined;
}
return pluginEntry.dock ?? buildDockFromPlugin(pluginEntry.plugin);
}