Fix 19 ESLint unused-variable errors across source and test files

Remove unused imports, functions, and variables flagged by
@typescript-eslint/no-unused-vars and no-useless-assignment rules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
fuomag9
2026-04-06 00:32:54 +02:00
parent 0542ed56cb
commit 155268a180
8 changed files with 13 additions and 26 deletions

View File

@@ -6,6 +6,7 @@ export default async function UsersPage() {
await requireAdmin();
const allUsers = await listUsers();
// Strip password hashes before sending to client
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const safeUsers = allUsers.map(({ password_hash, ...rest }) => rest);
return <UsersClient users={safeUsers} />;
}

View File

@@ -6,12 +6,10 @@ import { Card, CardContent } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Separator } from "@/components/ui/separator";
import { Textarea } from "@/components/ui/textarea";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Checkbox } from "@/components/ui/checkbox";
import { ShieldCheck, Plus, Trash2, UserPlus } from "lucide-react";
import { ShieldCheck, Plus, UserPlus } from "lucide-react";
import { useState, useEffect, useCallback } from "react";
import { AppDialog } from "@/components/ui/AppDialog";
import type { MtlsRole, MtlsRoleWithCertificates } from "@/lib/models/mtls-roles";
import type { IssuedClientCertificate } from "@/lib/models/issued-client-certificates";

View File

@@ -6,9 +6,6 @@ import {
forwardAuthExchanges,
forwardAuthAccess,
groupMembers,
users,
groups,
proxyHosts
} from "../db/schema";
import { and, eq, gt, inArray, lt } from "drizzle-orm";
@@ -218,13 +215,13 @@ export async function checkHostAccessByDomain(
});
for (const ph of allHosts) {
let domains: string[] = [];
let parsed: string[];
try {
domains = JSON.parse(ph.domains);
parsed = JSON.parse(ph.domains);
} catch {
continue;
}
if (domains.some((d) => d.toLowerCase() === host.toLowerCase())) {
if (parsed.some((d) => d.toLowerCase() === host.toLowerCase())) {
const hasAccess = await checkHostAccess(userId, ph.id);
return { hasAccess, proxyHostId: ph.id };
}
@@ -299,21 +296,21 @@ export async function isForwardAuthDomain(host: string): Promise<boolean> {
});
for (const ph of allHosts) {
let domains: string[] = [];
let parsed: string[];
try {
domains = JSON.parse(ph.domains);
parsed = JSON.parse(ph.domains);
} catch {
continue;
}
if (domains.some((d) => d.toLowerCase() === host.toLowerCase())) {
if (parsed.some((d) => d.toLowerCase() === host.toLowerCase())) {
// Check that this host actually has forward auth enabled
let meta: Record<string, unknown> = {};
let parsedMeta: Record<string, unknown>;
try {
meta = ph.meta ? JSON.parse(ph.meta) : {};
parsedMeta = ph.meta ? JSON.parse(ph.meta) : {};
} catch {
continue;
}
const fa = meta.cpm_forward_auth as Record<string, unknown> | undefined;
const fa = parsedMeta.cpm_forward_auth as Record<string, unknown> | undefined;
if (fa?.enabled) return true;
}
}

View File

@@ -6,7 +6,6 @@ import {
forwardAuthExchanges,
forwardAuthAccess,
groups,
groupMembers,
users,
proxyHosts
} from '@/src/lib/db/schema';
@@ -26,10 +25,6 @@ function futureIso(seconds: number) {
return new Date(Date.now() + seconds * 1000).toISOString();
}
function pastIso(seconds: number) {
return new Date(Date.now() - seconds * 1000).toISOString();
}
function hashToken(raw: string): string {
return createHash('sha256').update(raw).digest('hex');
}

View File

@@ -9,7 +9,6 @@ import {
proxyHosts,
users,
} from '../../src/lib/db/schema';
import { eq } from 'drizzle-orm';
let db: TestDb;

View File

@@ -8,7 +8,7 @@ import {
caCertificates,
proxyHosts,
} from '@/src/lib/db/schema';
import { eq, and } from 'drizzle-orm';
import { eq } from 'drizzle-orm';
let db: TestDb;

View File

@@ -6,13 +6,10 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { createTestDb, type TestDb } from '../helpers/db';
import {
mtlsRoles,
mtlsCertificateRoles,
issuedClientCertificates,
caCertificates,
users,
} from '../../src/lib/db/schema';
import { eq, isNull } from 'drizzle-orm';
let db: TestDb;

View File

@@ -5,7 +5,7 @@
* to ensure the new "trust user X" model works correctly alongside the legacy CA model.
*/
import { describe, it, expect } from 'vitest';
import { buildClientAuthentication, pemToBase64Der } from '../../src/lib/caddy-mtls';
import { buildClientAuthentication } from '../../src/lib/caddy-mtls';
function makeCaPem(label: string): string {
return `-----BEGIN CERTIFICATE-----\n${label}\n-----END CERTIFICATE-----`;