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,8 +8,12 @@ type ChannelConfigWithAccounts = {
};
function resolveAccountConfig(accounts: ChannelConfigWithAccounts["accounts"], accountId: string) {
if (!accounts || typeof accounts !== "object") return undefined;
if (accountId in accounts) return accounts[accountId];
if (!accounts || typeof accounts !== "object") {
return undefined;
}
if (accountId in accounts) {
return accounts[accountId];
}
const matchKey = Object.keys(accounts).find(
(key) => key.toLowerCase() === accountId.toLowerCase(),
);
@@ -21,10 +25,14 @@ export function resolveChannelConfigWrites(params: {
channelId?: ChannelId | null;
accountId?: string | null;
}): boolean {
if (!params.channelId) return true;
if (!params.channelId) {
return true;
}
const channels = params.cfg.channels as Record<string, ChannelConfigWithAccounts> | undefined;
const channelConfig = channels?.[params.channelId];
if (!channelConfig) return true;
if (!channelConfig) {
return true;
}
const accountId = normalizeAccountId(params.accountId);
const accountConfig = resolveAccountConfig(channelConfig.accounts, accountId);
const value = accountConfig?.configWrites ?? channelConfig.configWrites;