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

@@ -30,7 +30,9 @@ function createRuntimeStore(): ChannelRuntimeStore {
}
function isAccountEnabled(account: unknown): boolean {
if (!account || typeof account !== "object") return true;
if (!account || typeof account !== "object") {
return true;
}
const enabled = (account as { enabled?: boolean }).enabled;
return enabled !== false;
}
@@ -66,7 +68,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
const getStore = (channelId: ChannelId): ChannelRuntimeStore => {
const existing = channelStores.get(channelId);
if (existing) return existing;
if (existing) {
return existing;
}
const next = createRuntimeStore();
channelStores.set(channelId, next);
return next;
@@ -92,16 +96,22 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
const startChannel = async (channelId: ChannelId, accountId?: string) => {
const plugin = getChannelPlugin(channelId);
const startAccount = plugin?.gateway?.startAccount;
if (!startAccount) return;
if (!startAccount) {
return;
}
const cfg = loadConfig();
resetDirectoryCache({ channel: channelId, accountId });
const store = getStore(channelId);
const accountIds = accountId ? [accountId] : plugin.config.listAccountIds(cfg);
if (accountIds.length === 0) return;
if (accountIds.length === 0) {
return;
}
await Promise.all(
accountIds.map(async (id) => {
if (store.tasks.has(id)) return;
if (store.tasks.has(id)) {
return;
}
const account = plugin.config.resolveAccount(cfg, id);
const enabled = plugin.config.isEnabled
? plugin.config.isEnabled(account, cfg)
@@ -186,7 +196,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
Array.from(knownIds.values()).map(async (id) => {
const abort = store.aborts.get(id);
const task = store.tasks.get(id);
if (!abort && !task && !plugin?.gateway?.stopAccount) return;
if (!abort && !task && !plugin?.gateway?.stopAccount) {
return;
}
abort?.abort();
if (plugin?.gateway?.stopAccount) {
const account = plugin.config.resolveAccount(cfg, id);
@@ -225,7 +237,9 @@ export function createChannelManager(opts: ChannelManagerOptions): ChannelManage
const markChannelLoggedOut = (channelId: ChannelId, cleared: boolean, accountId?: string) => {
const plugin = getChannelPlugin(channelId);
if (!plugin) return;
if (!plugin) {
return;
}
const cfg = loadConfig();
const resolvedId =
accountId ??