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:
asepharyana
2026-08-01 22:09:02 +07:00
parent 2357421841
commit 6293d588bc
123 changed files with 466 additions and 308 deletions
@@ -1,7 +1,7 @@
import { type ChildProcess, spawn } from "node:child_process";
import { PassThrough, type Readable } from "node:stream";
import { createChildLogger } from "@/shared/logger/index";
import { StreamType } from "@discordjs/voice";
import { createChildLogger } from "@/shared/logger/index";
const logger = createChildLogger("media-source");
@@ -348,7 +348,9 @@ export function getDirectVideoUrl(url: string): Promise<string> {
if (code !== 0) {
const detail = stderrBuf.trim() ? `: ${stderrBuf.trim()}` : "";
reject(
new Error(`yt-dlp direct URL resolution exited with code ${code}${detail}`),
new Error(
`yt-dlp direct URL resolution exited with code ${code}${detail}`,
),
);
return;
}
@@ -1,6 +1,6 @@
import { createChildLogger } from "@/shared/logger/index";
import { eq } from "drizzle-orm";
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
import { createChildLogger } from "@/shared/logger/index";
import { getDatabase } from "../../shared/database/drizzle.js";
import type * as schema from "../../shared/database/schema.js";
import { muxerJobsTable } from "../../shared/database/schema.js";
@@ -1,5 +1,4 @@
import type { Readable } from "node:stream";
import { createChildLogger } from "@/shared/logger/index";
import {
type AudioPlayer,
AudioPlayerStatus,
@@ -9,6 +8,7 @@ import {
StreamType,
type VoiceConnection,
} from "@discordjs/voice";
import { createChildLogger } from "@/shared/logger/index";
import type { DiscordPlayerOwner, DiscordPlayOptions } from "./mediaTypes.js";
const logger = createChildLogger("player");
@@ -1,6 +1,4 @@
import { promises as fsPromises } from "node:fs";
import { createChildLogger } from "@/shared/logger/index";
import { retryWithBackoff } from "@/shared/utils/index";
import {
type DiscordGatewayAdapterCreator,
entersState,
@@ -10,6 +8,8 @@ import {
VoiceConnectionStatus,
} from "@discordjs/voice";
import type { Client, VoiceChannel } from "discord.js-selfbot-v13";
import { createChildLogger } from "@/shared/logger/index";
import { retryWithBackoff } from "@/shared/utils/index";
import { config } from "../../shared/config/config.js";
import type { EventBroadcaster } from "../event-broadcaster/eventBroadcaster.js";
import type { VoicePcmWsClient } from "../voice-pcm-ws/index.js";
@@ -1,6 +1,6 @@
import { createRequire } from "node:module";
import { createChildLogger } from "@/shared/logger/index";
import * as prism from "prism-media";
import { createChildLogger } from "@/shared/logger/index";
import { config } from "../../../shared/config/config.js";
const require = createRequire(import.meta.url);
@@ -1,6 +1,6 @@
import path from "node:path";
import { createChildLogger } from "@/shared/logger/index";
import type { Client, VoiceChannel } from "discord.js-selfbot-v13";
import { createChildLogger } from "@/shared/logger/index";
import { config } from "../../../shared/config/config.js";
import type {
SegmentMetadata,
@@ -1,7 +1,7 @@
import fs from "node:fs";
import path from "node:path";
import { createChildLogger } from "@/shared/logger/index";
import * as prism from "prism-media";
import { createChildLogger } from "@/shared/logger/index";
import type { SegmentState } from "../../message-capture/types.js";
const logger = createChildLogger("voice-segment");
@@ -1,8 +1,8 @@
import { promises as fsPromises } from "node:fs";
import path from "node:path";
import { createChildLogger } from "@/shared/logger/index";
import type { VoiceConnection } from "@discordjs/voice";
import type { Client, VoiceChannel } from "discord.js-selfbot-v13";
import { createChildLogger } from "@/shared/logger/index";
import type { EventBroadcaster } from "../../event-broadcaster/eventBroadcaster.js";
import { collectUserMetadata } from "./metadata.js";
import { finalizeSegment } from "./segmentFinalizer.js";
@@ -1,6 +1,6 @@
import { createChildLogger } from "@/shared/logger/index";
import type { VoiceConnection } from "@discordjs/voice";
import { EndBehaviorType } from "@discordjs/voice";
import { createChildLogger } from "@/shared/logger/index";
import { config } from "../../../shared/config/config.js";
import { PacketFilter } from "../packetFilter.js";
import { OpusDecoder } from "./decoder.js";
@@ -1,6 +1,6 @@
import { execFile } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { createChildLogger } from "@/shared/logger/index";
import { config } from "../../../shared/config/config.js";
@@ -1,14 +1,14 @@
import {
Encoders,
prepareStream,
playStream,
prepareStream,
Streamer,
Utils,
} from "@dank074/discord-video-stream";
import type { Client } from "discord.js-selfbot-v13";
import { createChildLogger } from "@/shared/logger/index";
import type { ScreenSharePlayback } from "./mediaTypes.js";
import { getDirectVideoUrl } from "./mediaSource.js";
import type { ScreenSharePlayback } from "./mediaTypes.js";
import { discordPlayer } from "./player.js";
const logger = createChildLogger("screen-share");
@@ -46,11 +46,7 @@ export class ScreenShareController {
async start(source: string): Promise<ScreenSharePlayback> {
const status = this.getVoiceStatus();
if (
!status.connected ||
!status.activeGuildId ||
!status.activeChannelId
) {
if (!status.connected || !status.activeGuildId || !status.activeChannelId) {
throw new Error("Connect to a voice channel before sharing screen");
}
@@ -81,15 +77,13 @@ export class ScreenShareController {
}).finally(() => {
this.active = null;
});
const controller = this;
this.active = {
done,
stop: () => {
if (stopped) return;
stopped = true;
command.kill("SIGTERM");
controller.active = null;
this.active = null;
},
};
@@ -1,9 +1,9 @@
import { spawn } from "node:child_process";
import { PassThrough } from "node:stream";
import { BACKEND_VOICE_TRANSMIT } from "../../shared/index.js";
import { createChildLogger } from "../../shared/logger/index.js";
import { StreamType } from "@discordjs/voice";
import type Redis from "ioredis";
import { BACKEND_VOICE_TRANSMIT } from "../../shared/index.js";
import { createChildLogger } from "../../shared/logger/index.js";
import { discordPlayer } from "./player.js";
const logger = createChildLogger("transmitter");
@@ -1,7 +1,7 @@
import { AppError } from "@/shared/errors/index";
import { createChildLogger } from "@/shared/logger/index";
import type { VoiceConnection } from "@discordjs/voice";
import type { Client, Guild, VoiceChannel } from "discord.js-selfbot-v13";
import { AppError } from "@/shared/errors/index";
import { createChildLogger } from "@/shared/logger/index";
import { discordPlayer } from "./player.js";
import { startRecording, stopRecording } from "./recorder.js";
@@ -1,8 +1,8 @@
// ─── Voice Transcription — AI-powered speech-to-text for voice recordings ────
import { createReadStream } from "node:fs";
import { createChildLogger } from "@/shared/logger/index";
import OpenAI from "openai";
import { createChildLogger } from "@/shared/logger/index";
import { config } from "../../shared/config/config.js";
const logger = createChildLogger("voice-transcriber");