chore: Enable more lint rules, disable some that trigger a lot. Will clean up later.

This commit is contained in:
cpojer
2026-01-31 16:03:28 +09:00
parent 481f696a87
commit 15792b153f
292 changed files with 643 additions and 699 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ function listConfiguredAccountIds(cfg: OpenClawConfig): string[] {
export function listSlackAccountIds(cfg: OpenClawConfig): string[] {
const ids = listConfiguredAccountIds(cfg);
if (ids.length === 0) return [DEFAULT_ACCOUNT_ID];
return ids.sort((a, b) => a.localeCompare(b));
return ids.toSorted((a, b) => a.localeCompare(b));
}
export function resolveDefaultSlackAccountId(cfg: OpenClawConfig): string {
+1 -1
View File
@@ -16,7 +16,7 @@ export function registerSlackReactionEvents(params: { ctx: SlackMonitorContext }
if (!item || item.type !== "message") return;
const channelInfo = item.channel ? await ctx.resolveChannelName(item.channel) : {};
const channelType = channelInfo?.type as SlackMessageEvent["channel_type"];
const channelType = channelInfo?.type;
if (
!ctx.isChannelAllowed({
channelId: item.channel,
+2 -3
View File
@@ -7,7 +7,6 @@ import { DEFAULT_GROUP_HISTORY_LIMIT } from "../../auto-reply/reply/history.js";
import { mergeAllowlist, summarizeMapping } from "../../channels/allowlists/resolve-utils.js";
import { loadConfig } from "../../config/config.js";
import type { SessionScope } from "../../config/sessions.js";
import type { DmPolicy, GroupPolicy } from "../../config/types.js";
import { warn } from "../../globals.js";
import { normalizeMainKey } from "../../routing/session-key.js";
import type { RuntimeEnv } from "../../runtime.js";
@@ -91,13 +90,13 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
const dmConfig = slackCfg.dm;
const dmEnabled = dmConfig?.enabled ?? true;
const dmPolicy = (dmConfig?.policy ?? "pairing") as DmPolicy;
const dmPolicy = dmConfig?.policy ?? "pairing";
let allowFrom = dmConfig?.allowFrom;
const groupDmEnabled = dmConfig?.groupEnabled ?? false;
const groupDmChannels = dmConfig?.groupChannels;
let channelsConfig = slackCfg.channels;
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
const groupPolicy = (slackCfg.groupPolicy ?? defaultGroupPolicy ?? "open") as GroupPolicy;
const groupPolicy = slackCfg.groupPolicy ?? defaultGroupPolicy ?? "open";
if (
slackCfg.groupPolicy === undefined &&
slackCfg.channels === undefined &&
+1 -1
View File
@@ -589,7 +589,7 @@ export function registerSlackMonitorSlashCommands(params: {
await handleSlashCommand({
command: commandPayload,
ack: async () => {},
respond: respondFn as SlackCommandMiddlewareArgs["respond"],
respond: respondFn,
prompt,
commandArgs,
commandDefinition: commandDefinition ?? undefined,
+1 -1
View File
@@ -72,7 +72,7 @@ export function createSlackThreadTsResolver(params: {
return;
}
while (cache.size > maxSize) {
const oldestKey = cache.keys().next().value as string | undefined;
const oldestKey = cache.keys().next().value;
if (!oldestKey) break;
cache.delete(oldestKey);
}
+2 -2
View File
@@ -127,7 +127,7 @@ export async function resolveSlackUserAllowlist(params: {
if (matches.length > 0) {
const scored = matches
.map((user) => ({ user, score: scoreSlackUser(user, parsed) }))
.sort((a, b) => b.score - a.score);
.toSorted((a, b) => b.score - a.score);
const best = scored[0]?.user ?? matches[0];
results.push({
input,
@@ -153,7 +153,7 @@ export async function resolveSlackUserAllowlist(params: {
if (matches.length > 0) {
const scored = matches
.map((user) => ({ user, score: scoreSlackUser(user, parsed) }))
.sort((a, b) => b.score - a.score);
.toSorted((a, b) => b.score - a.score);
const best = scored[0]?.user ?? matches[0];
results.push({
input,
+1 -1
View File
@@ -41,7 +41,7 @@ function collectScopes(value: unknown, into: string[]) {
}
function normalizeScopes(scopes: string[]) {
return Array.from(new Set(scopes.map((scope) => scope.trim()).filter(Boolean))).sort();
return Array.from(new Set(scopes.map((scope) => scope.trim()).filter(Boolean))).toSorted();
}
function extractScopes(payload: unknown): string[] {