chore(lint): biome cleanup across services — format, sort imports, drop unused
- discord-gateway: 74 lint errors -> 0 (format, import sorting, unused imports/vars, dead breath var) - backend: format + sort imports (11 warnings left: noExplicitAny) - frontend: remove unused imports, drop dead breathing var, fix useExhaustiveDependencies (scroll keyed on messages), a11y biome-ignore for drag surface + stopPropagation container (mouse-only gestures) - remaining warnings are false positives: index keys on static lists, <img> in static export (next/image unsupported), noExplicitAny tsc --noEmit clean on all 3 services; vitest green (60+36).
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Guild } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client, PermissionString } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { messageStore } from "../message-capture/messageStore.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import {
|
||||
type ChannelCulture,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { encoding_for_model as encodingForModel } from "tiktoken";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import {
|
||||
formatMediaEvidenceForPrompt,
|
||||
renderDiscordMentions,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { LRUCache } from "lru-cache";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { LAST_ERROR } from "./moderationState.js";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { and, desc, eq, sql } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
|
||||
@@ -27,7 +27,16 @@ export function sanitizeDiscordTokens(content: string): string {
|
||||
if (!content.includes("<")) return content;
|
||||
return content.replace(
|
||||
DISCORD_TOKEN_RE,
|
||||
(_full, emojiName, _emojiId, _userId, _roleId, _channelId, _time, _style) => {
|
||||
(
|
||||
_full,
|
||||
emojiName,
|
||||
_emojiId,
|
||||
_userId,
|
||||
_roleId,
|
||||
_channelId,
|
||||
_time,
|
||||
_style,
|
||||
) => {
|
||||
if (emojiName) return `[emoji:${emojiName}]`;
|
||||
// Capture groups tell us which alternative matched by position:
|
||||
// 3=user, 4=role, 5=channel, 6=time
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
export { startPendingAIAnalysisWorker } from "./aiAnalyzer.js";
|
||||
export { runModerationAnalysis } from "./moderationOrchestrator.js";
|
||||
export { buildSystemPrompt } from "./moderationPrompt.js";
|
||||
export { sanitizeDiscordTokens } from "./discordTokens.js";
|
||||
|
||||
// ── Single-pass LLM pipeline exports ─────────────────────────────────────
|
||||
export type {
|
||||
AnalysisInput,
|
||||
AnalysisResult,
|
||||
WorkerConfig,
|
||||
MessageBatch,
|
||||
WorkerConfig,
|
||||
} from "./ai-analysis-worker.js";
|
||||
export { startPendingAIAnalysisWorker } from "./aiAnalyzer.js";
|
||||
export { sanitizeDiscordTokens } from "./discordTokens.js";
|
||||
export { runModerationAnalysis } from "./moderationOrchestrator.js";
|
||||
export { buildSystemPrompt } from "./moderationPrompt.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { LRUCache } from "lru-cache";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { messageStore } from "../message-capture/messageStore.js";
|
||||
import type {
|
||||
@@ -99,9 +99,7 @@ async function processIndividualFallback(
|
||||
// retryable error — the recovery worker picks it up later. Producing a
|
||||
// regex/wordlist verdict here would reintroduce false positives.
|
||||
if (!analysisResult) {
|
||||
throw new Error(
|
||||
`LLM analysis failed for message ${messageId}`,
|
||||
);
|
||||
throw new Error(`LLM analysis failed for message ${messageId}`);
|
||||
}
|
||||
|
||||
// Main thread: DB writes + broadcast
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* Used by both mediaAnalysisClient.ts and moderationOrchestrator.ts.
|
||||
*/
|
||||
|
||||
import { renderDiscordMentions } from "../message-capture/messageMetadata.js";
|
||||
import { messageStore } from "../message-capture/messageStore.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
import { renderDiscordMentions } from "../message-capture/messageMetadata.js";
|
||||
import { sanitizeDiscordTokens } from "./discordTokens.js";
|
||||
|
||||
/** Simple XML-escaping for content text. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { z } from "zod";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { AnalysisResult } from "../message-capture/types.js";
|
||||
import type {
|
||||
RecommendedActionSchema,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { z } from "zod";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
|
||||
const log = createChildLogger("moderationSchemas");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import type { Client } from "discord.js-selfbot-v13";
|
||||
import { LRUCache } from "lru-cache";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/index.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Redis from "ioredis";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { createAbortControllerWithTimeout } from "@/shared/utils/index";
|
||||
import Redis from "ioredis";
|
||||
|
||||
const log = createChildLogger("searxng-search");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { and, desc, eq, sql } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import { messagesTable } from "../../shared/database/schema.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { createChildLogger } from "@/shared/logger/index";
|
||||
import { getDatabase } from "../../shared/database/drizzle.js";
|
||||
import {
|
||||
type UserProfile,
|
||||
|
||||
Reference in New Issue
Block a user