Add pre-commit hooks for linting and formatting
Set up pre-commit framework with ruff (backend) and ESLint/Prettier/tsc (frontend) hooks to catch issues locally before CI. Auto-format all frontend files with Prettier to comply with the new check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,19 +16,28 @@ export function AdminRuns() {
|
||||
|
||||
const gameMap = useMemo(
|
||||
() => new Map(games.map((g) => [g.id, g.name])),
|
||||
[games],
|
||||
[games]
|
||||
)
|
||||
|
||||
const filteredRuns = useMemo(() => {
|
||||
let result = runs
|
||||
if (statusFilter) result = result.filter((r) => r.status === statusFilter)
|
||||
if (gameFilter) result = result.filter((r) => r.gameId === Number(gameFilter))
|
||||
if (gameFilter)
|
||||
result = result.filter((r) => r.gameId === Number(gameFilter))
|
||||
return result
|
||||
}, [runs, statusFilter, gameFilter])
|
||||
|
||||
const runGames = useMemo(
|
||||
() => [...new Map(runs.map((r) => [r.gameId, gameMap.get(r.gameId) ?? `Game #${r.gameId}`])).entries()].sort((a, b) => a[1].localeCompare(b[1])),
|
||||
[runs, gameMap],
|
||||
() =>
|
||||
[
|
||||
...new Map(
|
||||
runs.map((r) => [
|
||||
r.gameId,
|
||||
gameMap.get(r.gameId) ?? `Game #${r.gameId}`,
|
||||
])
|
||||
).entries(),
|
||||
].sort((a, b) => a[1].localeCompare(b[1])),
|
||||
[runs, gameMap]
|
||||
)
|
||||
|
||||
const columns: Column<NuzlockeRun>[] = [
|
||||
@@ -86,12 +95,17 @@ export function AdminRuns() {
|
||||
>
|
||||
<option value="">All games</option>
|
||||
{runGames.map(([id, name]) => (
|
||||
<option key={id} value={id}>{name}</option>
|
||||
<option key={id} value={id}>
|
||||
{name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{(statusFilter || gameFilter) && (
|
||||
<button
|
||||
onClick={() => { setStatusFilter(''); setGameFilter('') }}
|
||||
onClick={() => {
|
||||
setStatusFilter('')
|
||||
setGameFilter('')
|
||||
}}
|
||||
className="text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
|
||||
>
|
||||
Clear filters
|
||||
@@ -120,7 +134,10 @@ export function AdminRuns() {
|
||||
onSuccess: () => setDeleting(null),
|
||||
})
|
||||
}
|
||||
onCancel={() => { setDeleting(null); deleteRun.reset() }}
|
||||
onCancel={() => {
|
||||
setDeleting(null)
|
||||
deleteRun.reset()
|
||||
}}
|
||||
isDeleting={deleteRun.isPending}
|
||||
error={deleteRun.error?.message ?? null}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user