Fix frontend lint: links, unused code, quotes, img elements

- Internal links use next/link instead of <a> (no full page reload).
- Remove dead code: RegisterForm's unreachable Yoco checkout branch, the
  unused AttendeeForms on the registration success page, unused Geist
  fonts, and assorted unused variables and catch bindings.
- Escape quotes in JSX text; replace @ts-ignore in apiFetch with a cast.
- Keep the intentional raw <img> elements (data URLs, runtime API host)
  with a documented lint exception; the event editor uses ApiImage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 11:10:00 +02:00
co-authored by Claude Opus 5.5
parent 700b220906
commit 9e8244bb71
33 changed files with 73 additions and 266 deletions
@@ -225,19 +225,19 @@ export function LoginForm() {
</button>
</div>
<div className="mt-1">
<a
<Link
href="/forgot-password"
className="text-xs text-brand-600 hover:underline"
>
Forgot your password?
</a>
</Link>
</div>
<div className="mt-1">
<a
href={registerHref}
className="text-xs text-brand-600 hover:underline"
>
Don't have an account? Sign up here.
Don&apos;t have an account? Sign up here.
</a>
</div>
</div>
@@ -190,7 +190,7 @@ export const QRScanner = React.forwardRef<QRScannerHandle, QRScannerProps>(
/>
) : (
<div className="absolute inset-0 flex items-center justify-center text-white/80 text-sm p-4 text-center">
Camera is off. Tap "Scan Ticket" to start using the back camera.
Camera is off. Tap &quot;Scan Ticket&quot; to start using the back camera.
</div>
)}
</div>
@@ -243,7 +243,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
try {
const list = await apiFetch<any[]>(`/api/payments/event/${encodeURIComponent(id)}`, { authToken: token });
byEv[id] = Array.isArray(list) ? list : [];
} catch (e) {
} catch {
byEv[id] = [];
}
}
@@ -257,7 +257,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
try {
const list = await apiFetch<any[]>(`/api/registrations/event/${encodeURIComponent(id)}`, { authToken: token });
byEv[id] = Array.isArray(list) ? list : [];
} catch (e) {
} catch {
byEv[id] = [];
}
}
@@ -271,7 +271,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
try {
const tickets = await apiFetch<any[]>(`/api/tickets/event/${encodeURIComponent(id)}`, { authToken: token });
result[id] = { used: tickets.filter(t => t.isUsed).length, unused: tickets.filter(t => !t.isUsed).length };
} catch (e) {
} catch {
result[id] = { used: 0, unused: 0 };
}
}
@@ -284,7 +284,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
for (const id of eventIds) {
try {
byEv[id] = await apiFetch<any>(`/api/cashups/event/${encodeURIComponent(id)}`, { authToken: token });
} catch (e) {
} catch {
byEv[id] = null;
}
}
@@ -320,7 +320,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
if (dateTo) query.set("to", dateTo);
try {
return await apiFetch<any[]>(`/api/coupons/redemptions?${query.toString()}`, { authToken: token });
} catch (e) {
} catch {
return [];
}
};
@@ -350,7 +350,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
const idSet = new Set(eventIds);
const filtered = eventIds.length > 1 ? (rows || []).filter(r => idSet.has(r.eventId)) : (rows || []);
return computeAuditDeltas(filtered).sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
} catch (e) {
} catch {
return [];
}
};
@@ -2192,7 +2192,7 @@ export default function ReportsV2({ onBack }: { onBack?: () => void } = {}) {
</div>
</div>
<div className="text-xs text-gray-500 mb-2">
Every donation logged for these events, who gave it, and how much of it has been applied to an order (Used) versus still available (Unused). This is independent of the orders table above — a donation isn't tied to the donor's own order.
Every donation logged for these events, who gave it, and how much of it has been applied to an order (Used) versus still available (Unused). This is independent of the orders table above — a donation isn&apos;t tied to the donor&apos;s own order.
</div>
{donationsMadeRows.length === 0 ? (
<div className="text-sm text-gray-500">No donations logged for these events.</div>
@@ -34,5 +34,8 @@ export function ApiImage({ src, alt = "", className, style }: Props) {
// and then jump once resolved — same class of flash as an unauthenticated nav link showing too early.
if (!resolved) return <div className={`${className || ""} bg-gray-100 animate-pulse`} style={style} aria-hidden="true" />;
// A plain <img>: the API host is only known at runtime and the images have no fixed size,
// so next/image's optimizer (which needs both up front) doesn't fit here.
// eslint-disable-next-line @next/next/no-img-element
return <img src={resolved} alt={alt} className={className} style={style} />;
}
@@ -27,5 +27,7 @@ export function QrImage({ value, size = 120, alt = "QR", className }: Props) {
}, [value, size]);
if (!dataUrl) return <div className={`${className || ""} bg-gray-100 animate-pulse`} aria-hidden="true" />;
// A data: URL generated in the browser — nothing for next/image to optimize.
// eslint-disable-next-line @next/next/no-img-element
return <img src={dataUrl} alt={alt} className={className} />;
}