fix(lint): clear remaining biome errors (unused code, optional chains, non-null assertions, effect deps)

This commit is contained in:
SnapOtter
2026-06-21 01:49:48 +08:00
parent 7561f2a8c3
commit 19dc6ba554
20 changed files with 17 additions and 26 deletions
+1 -1
View File
@@ -326,7 +326,7 @@ export async function authRoutes(app: FastifyInstance): Promise<void> {
const audit = auditFromRequest(request);
if (!user || !user.passwordHash) {
if (!user?.passwordHash) {
authAttempts.inc({ method: "password", result: "failure" });
await audit("LOGIN_FAILED", {
username: sanitizeAuditInput(body.username),
+1 -1
View File
@@ -108,7 +108,7 @@ export async function registerSaml(app: FastifyInstance): Promise<void> {
return redirectToLogin(reply, "saml_auth_failed");
}
if (!profile || !profile.nameID) {
if (!profile?.nameID) {
request.log.warn("SAML callback: no profile or nameID in assertion");
authAttempts.inc({ method: "saml", result: "failure" });
await audit("SAML_LOGIN_FAILED", { reason: "missing_profile" });
+2 -1
View File
@@ -456,7 +456,8 @@ export async function registerBatchRoutes(app: FastifyInstance): Promise<void> {
// Append results from object storage in original upload order
try {
for (const entry of successEntries) {
const stream = await getObjectStream(entry.outputRef!);
if (!entry.outputRef) continue;
const stream = await getObjectStream(entry.outputRef);
archive.append(stream, { name: entry.filename });
}
+1 -1
View File
@@ -4,7 +4,7 @@ import { z } from "zod";
import { env } from "../../config.js";
import { db, schema } from "../../db/index.js";
import { auditFromRequest } from "../../lib/audit.js";
import { encrypt, isEncrypted } from "../../lib/encryption.js";
import { encrypt } from "../../lib/encryption.js";
import { requirePermission } from "../../permissions.js";
const configSchema = z.object({
+2 -1
View File
@@ -1161,7 +1161,8 @@ export async function registerPipelineRoutes(app: FastifyInstance): Promise<void
// Append results from object storage in original upload order
try {
for (const entry of successEntries) {
const stream = await getObjectStream(entry.outputRef!);
if (!entry.outputRef) continue;
const stream = await getObjectStream(entry.outputRef);
archive.append(stream, { name: entry.filename });
}
+1 -1
View File
@@ -387,7 +387,7 @@ export async function registerProgressRoutes(app: FastifyInstance): Promise<void
if (!sseListeners.has(jobId)) {
sseListeners.set(jobId, new Set());
}
sseListeners.get(jobId)!.add(callback);
sseListeners.get(jobId)?.add(callback);
// Clean up on client disconnect
request.raw.on("close", () => {
+2 -1
View File
@@ -88,9 +88,10 @@ export function registerHtmlToImage(app: FastifyInstance) {
isMobile: preset.isMobile,
};
// Zod refine guarantees either url or html is present
const buffer = settings.html
? await captureHtml(settings.html, captureOpts)
: await capturePage(settings.url!, captureOpts);
: await capturePage(settings.url ?? "", captureOpts);
const jobId = randomUUID();
const ext = settings.format;