From fcfcce614ae7e80ffbc88bd11dfb0bc409773642 Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Wed, 29 Apr 2026 00:54:39 +0800 Subject: [PATCH] chore: fix lint and type errors from feature bundle implementation --- app/compare/page.tsx | 4 +-- components/charts/StabilityScatterChart.tsx | 1 + components/compare/game-selector.tsx | 26 +++++++++---------- components/wizard/non-steam-edit-form.tsx | 4 +-- .../wizard/steps/non-steam-review-step.tsx | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/compare/page.tsx b/app/compare/page.tsx index d4c8279..4d1bbf7 100644 --- a/app/compare/page.tsx +++ b/app/compare/page.tsx @@ -64,8 +64,8 @@ export default function ComparePage() { } const data = await res.json() setComparisonData(data.games || []) - } catch (err: any) { - setError(err.message || "Failed to load comparison") + } catch (err: unknown) { + setError(err instanceof Error ? err.message : "Failed to load comparison") } finally { setLoading(false) } diff --git a/components/charts/StabilityScatterChart.tsx b/components/charts/StabilityScatterChart.tsx index 6cbed23..35eed19 100644 --- a/components/charts/StabilityScatterChart.tsx +++ b/components/charts/StabilityScatterChart.tsx @@ -49,6 +49,7 @@ export function StabilityScatterChart({ data, deviceNames }: { data: ScatterPoin const option = { tooltip: { trigger: "item" as const, + // eslint-disable-next-line @typescript-eslint/no-explicit-any formatter: (params: any) => { if (params.seriesName === "Perfect Stability") return "" return `${params.seriesName}
Avg: ${params.value[0]} fps
1% Low: ${params.value[1]} fps` diff --git a/components/compare/game-selector.tsx b/components/compare/game-selector.tsx index c0f0a7e..26cba01 100644 --- a/components/compare/game-selector.tsx +++ b/components/compare/game-selector.tsx @@ -3,6 +3,7 @@ import { useState, useEffect, useRef } from "react" import Image from "next/image" import { SearchIcon, XIcon, Gamepad2Icon } from "lucide-react" +import { useDebounce } from "@/lib/hooks/useDebounce" interface SearchResult { id: string @@ -25,28 +26,28 @@ export function GameSelector({ selectedGames, onSelect, onRemove, maxSelections const [loading, setLoading] = useState(false) const [open, setOpen] = useState(false) const wrapperRef = useRef(null) + const debouncedQuery = useDebounce(query, 300) useEffect(() => { - if (query.length < 2) { - setResults([]) + if (debouncedQuery.length < 2) { return } let cancelled = false - const timeout = setTimeout(async () => { + async function fetchResults() { setLoading(true) try { - const res = await fetch(`/api/search/unified?q=${encodeURIComponent(query)}`) + const res = await fetch(`/api/search/unified?q=${encodeURIComponent(debouncedQuery)}`) if (!res.ok) throw new Error("Search failed") - const data = await res.json() + const data = await res.json() as { results: Array<{ id?: string; appId?: number; title: string; image: string | null; source: string }> } if (!cancelled) { setResults( (data.results || []) - .filter((r: any) => !selectedGames.some(sg => sg.id === (r.id || `steam-${r.appId}`))) + .filter((r) => !selectedGames.some(sg => sg.id === (r.id || `steam-${r.appId}`))) .slice(0, 8) - .map((r: any) => ({ + .map((r) => ({ id: r.id || `steam-${r.appId}`, - appId: r.appId, + appId: r.appId ?? null, title: r.title, image: r.image, source: r.source, @@ -58,13 +59,12 @@ export function GameSelector({ selectedGames, onSelect, onRemove, maxSelections } finally { if (!cancelled) setLoading(false) } - }, 300) - + } + fetchResults() return () => { cancelled = true - clearTimeout(timeout) } - }, [query, selectedGames]) + }, [debouncedQuery, selectedGames]) // Close dropdown on outside click useEffect(() => { @@ -122,7 +122,7 @@ export function GameSelector({ selectedGames, onSelect, onRemove, maxSelections {/* Dropdown results */} - {open && (query.length >= 2) && ( + {open && (debouncedQuery.length >= 2) && (
{loading && (
Searching...
diff --git a/components/wizard/non-steam-edit-form.tsx b/components/wizard/non-steam-edit-form.tsx index 70a9a10..80d44cd 100644 --- a/components/wizard/non-steam-edit-form.tsx +++ b/components/wizard/non-steam-edit-form.tsx @@ -98,8 +98,8 @@ export function NonSteamEditForm({ game, platformSupport, hardwareList, isOwner, } router.push(`/game/${game.id}`) router.refresh() - } catch (err: any) { - setError(err.message || "Failed to update game") + } catch (err: unknown) { + setError(err instanceof Error ? err.message : "Failed to update game") } finally { setLoading(false) } diff --git a/components/wizard/steps/non-steam-review-step.tsx b/components/wizard/steps/non-steam-review-step.tsx index ad9ec4d..263067e 100644 --- a/components/wizard/steps/non-steam-review-step.tsx +++ b/components/wizard/steps/non-steam-review-step.tsx @@ -1,6 +1,6 @@ "use client" -import { ImageIcon, Monitor, Info, FileText, Link, Calendar } from "lucide-react" +import { ImageIcon, Monitor, Info, FileText, Link } from "lucide-react" import { BasicInfoData } from "./non-steam-basic-info-step" import { PlatformSupportItem } from "./non-steam-platform-step"