Add Prettier and ESLint tooling (Refs #77)

This commit is contained in:
2026-10-09 15:56:13 -04:00
parent 8ed059b8d3
commit 16469e2d43
711 changed files with 99737 additions and 28286 deletions
@@ -9,16 +9,36 @@ export async function load({ params, url }: { params: { guid: string }; url: URL
const map = url.searchParams.get('map');
const requestedMetric = url.searchParams.get('metric');
const players = url.searchParams.get('players');
if ((game !== null && game !== 't5' && game !== 't6') || (map !== null && map.length > 1024)
|| (requestedMetric !== null && !isLeaderboardMetric(requestedMetric))
|| (players !== null && !/^[1-4]$/.test(players))) {
error(400, 'Use game t5 or t6, a supported metric, players 1–4, and a map key up to 1024 characters.');
if (
(game !== null && game !== 't5' && game !== 't6') ||
(map !== null && map.length > 1024) ||
(requestedMetric !== null && !isLeaderboardMetric(requestedMetric)) ||
(players !== null && !/^[1-4]$/.test(players))
) {
error(
400,
'Use game t5 or t6, a supported metric, players 1–4, and a map key up to 1024 characters.'
);
}
const metric = requestedMetric !== null && isLeaderboardMetric(requestedMetric) ? requestedMetric : 'highestRound';
const options = { game: game || undefined, map: map || undefined,
players: players === null ? undefined : Number(players) as LeaderboardPlayerCount, metric };
const { profile, entry } = await playerReport(params.guid, Number(url.searchParams.get('offset') ?? 0), options);
const metric =
requestedMetric !== null && isLeaderboardMetric(requestedMetric)
? requestedMetric
: 'highestRound';
const options = {
game: game || undefined,
map: map || undefined,
players: players === null ? undefined : (Number(players) as LeaderboardPlayerCount),
metric
};
const { profile, entry } = await playerReport(
params.guid,
Number(url.searchParams.get('offset') ?? 0),
options
);
if (!profile) error(404, 'No recorded stats found for this player');
return { profile, returnTo: leaderboardReturnHref(url.searchParams.get('returnTo')),
scope: { game: game ?? '', map: map ?? '', players: players ?? '', metric, entry } };
return {
profile,
returnTo: leaderboardReturnHref(url.searchParams.get('returnTo')),
scope: { game: game ?? '', map: map ?? '', players: players ?? '', metric, entry }
};
}