chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -1,9 +1,6 @@
import type { App } from "@slack/bolt";
import type { HistoryEntry } from "../../auto-reply/reply/history.js";
import type {
ClawdbotConfig,
SlackReactionNotificationMode,
} from "../../config/config.js";
import type { ClawdbotConfig, SlackReactionNotificationMode } from "../../config/config.js";
import { resolveSessionKey, type SessionScope } from "../../config/sessions.js";
import type { DmPolicy, GroupPolicy } from "../../config/types.js";
import { logVerbose } from "../../globals.js";
@@ -12,11 +9,7 @@ import { getChildLogger } from "../../logging.js";
import type { RuntimeEnv } from "../../runtime.js";
import type { SlackMessageEvent } from "../types.js";
import {
normalizeAllowList,
normalizeAllowListLower,
normalizeSlackSlug,
} from "./allow-list.js";
import { normalizeAllowList, normalizeAllowListLower, normalizeSlackSlug } from "./allow-list.js";
import { resolveSlackChannelConfig } from "./channel-config.js";
import { isSlackRoomAllowedByPolicy } from "./policy.js";
@@ -57,9 +50,7 @@ export type SlackMonitorContext = {
reactionMode: SlackReactionNotificationMode;
reactionAllowlist: Array<string | number>;
replyToMode: "off" | "first" | "all";
slashCommand: Required<
import("../../config/config.js").SlackSlashCommandConfig
>;
slashCommand: Required<import("../../config/config.js").SlackSlashCommandConfig>;
textLimit: number;
ackReactionScope: string;
mediaMaxBytes: number;
@@ -174,8 +165,7 @@ export function createSlackMonitorContext(params: {
token: params.botToken,
channel: channelId,
});
const name =
info.channel && "name" in info.channel ? info.channel.name : undefined;
const name = info.channel && "name" in info.channel ? info.channel.name : undefined;
const channel = info.channel ?? undefined;
const type: SlackMessageEvent["channel_type"] | undefined = channel?.is_im
? "im"
@@ -186,14 +176,9 @@ export function createSlackMonitorContext(params: {
: channel?.is_group
? "group"
: undefined;
const topic =
channel && "topic" in channel
? (channel.topic?.value ?? undefined)
: undefined;
const topic = channel && "topic" in channel ? (channel.topic?.value ?? undefined) : undefined;
const purpose =
channel && "purpose" in channel
? (channel.purpose?.value ?? undefined)
: undefined;
channel && "purpose" in channel ? (channel.purpose?.value ?? undefined) : undefined;
const entry = { name, type, topic, purpose };
channelCache.set(channelId, entry);
return entry;
@@ -211,11 +196,7 @@ export function createSlackMonitorContext(params: {
user: userId,
});
const profile = info.user?.profile;
const name =
profile?.display_name ||
profile?.real_name ||
info.user?.name ||
undefined;
const name = profile?.display_name || profile?.real_name || info.user?.name || undefined;
const entry = { name };
userCache.set(userId, entry);
return entry;
@@ -253,9 +234,7 @@ export function createSlackMonitorContext(params: {
await client.apiCall("assistant.threads.setStatus", payload);
}
} catch (err) {
logVerbose(
`slack status update failed for channel ${p.channelId}: ${String(err)}`,
);
logVerbose(`slack status update failed for channel ${p.channelId}: ${String(err)}`);
}
};
@@ -283,8 +262,7 @@ export function createSlackMonitorContext(params: {
.filter((value): value is string => Boolean(value))
.map((value) => value.toLowerCase());
const permitted =
allowList.includes("*") ||
candidates.some((candidate) => allowList.includes(candidate));
allowList.includes("*") || candidates.some((candidate) => allowList.includes(candidate));
if (!permitted) return false;
}
@@ -296,8 +274,7 @@ export function createSlackMonitorContext(params: {
});
const channelAllowed = channelConfig?.allowed !== false;
const channelAllowlistConfigured =
Boolean(params.channelsConfig) &&
Object.keys(params.channelsConfig ?? {}).length > 0;
Boolean(params.channelsConfig) && Object.keys(params.channelsConfig ?? {}).length > 0;
if (
!isSlackRoomAllowedByPolicy({
groupPolicy: params.groupPolicy,