mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 16:48:26 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -25,19 +25,25 @@ function resolveMarkdownModeFromSection(
|
||||
section: MarkdownConfigSection | undefined,
|
||||
accountId?: string | null,
|
||||
): MarkdownTableMode | undefined {
|
||||
if (!section) return undefined;
|
||||
if (!section) {
|
||||
return undefined;
|
||||
}
|
||||
const normalizedAccountId = normalizeAccountId(accountId);
|
||||
const accounts = section.accounts;
|
||||
if (accounts && typeof accounts === "object") {
|
||||
const direct = accounts[normalizedAccountId];
|
||||
const directMode = direct?.markdown?.tables;
|
||||
if (isMarkdownTableMode(directMode)) return directMode;
|
||||
if (isMarkdownTableMode(directMode)) {
|
||||
return directMode;
|
||||
}
|
||||
const matchKey = Object.keys(accounts).find(
|
||||
(key) => key.toLowerCase() === normalizedAccountId.toLowerCase(),
|
||||
);
|
||||
const match = matchKey ? accounts[matchKey] : undefined;
|
||||
const matchMode = match?.markdown?.tables;
|
||||
if (isMarkdownTableMode(matchMode)) return matchMode;
|
||||
if (isMarkdownTableMode(matchMode)) {
|
||||
return matchMode;
|
||||
}
|
||||
}
|
||||
const sectionMode = section.markdown?.tables;
|
||||
return isMarkdownTableMode(sectionMode) ? sectionMode : undefined;
|
||||
@@ -50,7 +56,9 @@ export function resolveMarkdownTableMode(params: {
|
||||
}): MarkdownTableMode {
|
||||
const channel = normalizeChannelId(params.channel);
|
||||
const defaultMode = channel ? (DEFAULT_TABLE_MODES.get(channel) ?? "code") : "code";
|
||||
if (!channel || !params.cfg) return defaultMode;
|
||||
if (!channel || !params.cfg) {
|
||||
return defaultMode;
|
||||
}
|
||||
const channelsConfig = params.cfg.channels as Record<string, unknown> | undefined;
|
||||
const section = (channelsConfig?.[channel] ??
|
||||
(params.cfg as Record<string, unknown> | undefined)?.[channel]) as
|
||||
|
||||
Reference in New Issue
Block a user