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

@@ -18,8 +18,12 @@ function shouldStoreNameInAccounts(params: {
accountId: string;
alwaysUseAccounts?: boolean;
}): boolean {
if (params.alwaysUseAccounts) return true;
if (params.accountId !== DEFAULT_ACCOUNT_ID) return true;
if (params.alwaysUseAccounts) {
return true;
}
if (params.accountId !== DEFAULT_ACCOUNT_ID) {
return true;
}
return channelHasAccounts(params.cfg, params.channelKey);
}
@@ -31,7 +35,9 @@ export function applyAccountNameToChannelSection(params: {
alwaysUseAccounts?: boolean;
}): OpenClawConfig {
const trimmed = params.name?.trim();
if (!trimmed) return params.cfg;
if (!trimmed) {
return params.cfg;
}
const accountId = normalizeAccountId(params.accountId);
const channels = params.cfg.channels as Record<string, unknown> | undefined;
const baseConfig = channels?.[params.channelKey];
@@ -85,11 +91,15 @@ export function migrateBaseNameToDefaultAccount(params: {
channelKey: string;
alwaysUseAccounts?: boolean;
}): OpenClawConfig {
if (params.alwaysUseAccounts) return params.cfg;
if (params.alwaysUseAccounts) {
return params.cfg;
}
const channels = params.cfg.channels as Record<string, unknown> | undefined;
const base = channels?.[params.channelKey] as ChannelSectionBase | undefined;
const baseName = base?.name?.trim();
if (!baseName) return params.cfg;
if (!baseName) {
return params.cfg;
}
const accounts: Record<string, Record<string, unknown>> = {
...base?.accounts,
};