mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 13:07:39 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -11,7 +11,9 @@ const isStringArray = (value: unknown): value is string[] =>
|
||||
function normalizeCapabilities(capabilities: CapabilitiesConfig | undefined): string[] | undefined {
|
||||
// Handle object-format capabilities (e.g., { inlineButtons: "dm" }) gracefully.
|
||||
// Channel-specific handlers (like resolveTelegramInlineButtonsScope) process these separately.
|
||||
if (!isStringArray(capabilities)) return undefined;
|
||||
if (!isStringArray(capabilities)) {
|
||||
return undefined;
|
||||
}
|
||||
const normalized = capabilities.map((entry) => entry.trim()).filter(Boolean);
|
||||
return normalized.length > 0 ? normalized : undefined;
|
||||
}
|
||||
@@ -23,7 +25,9 @@ function resolveAccountCapabilities(params: {
|
||||
accountId?: string | null;
|
||||
}): string[] | undefined {
|
||||
const cfg = params.cfg;
|
||||
if (!cfg) return undefined;
|
||||
if (!cfg) {
|
||||
return undefined;
|
||||
}
|
||||
const normalizedAccountId = normalizeAccountId(params.accountId);
|
||||
|
||||
const accounts = cfg.accounts;
|
||||
@@ -51,7 +55,9 @@ export function resolveChannelCapabilities(params: {
|
||||
}): string[] | undefined {
|
||||
const cfg = params.cfg;
|
||||
const channel = normalizeChannelId(params.channel);
|
||||
if (!cfg || !channel) return undefined;
|
||||
if (!cfg || !channel) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const channelsConfig = cfg.channels as Record<string, unknown> | undefined;
|
||||
const channelConfig = (channelsConfig?.[channel] ?? (cfg as Record<string, unknown>)[channel]) as
|
||||
|
||||
Reference in New Issue
Block a user