From 49879c43ebd9f36ec19f4c02fa2b121314126286 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 29 May 2026 23:44:08 +0000 Subject: style: apply biome autofixes and resolve remaining lint findings Auto-fixed cosmetic findings (import ordering, obj["k"]->obj.k, optional chaining, template literals, Date.now, parseInt radix, useless ternaries/ switch cases). Resolved the non-autofixable rest by hand: - Senpy: static-only class -> object literal (no this/static reliance). - app.html: var global shim -> window.global = window (keeps the shim, drops the unused-var flag). - biome-ignore with rationale for the logout document.cookie clear and the holodule scrape non-null assertion. Verified: biome check 0 diagnostics, svelte-check 0/0, 24/24 unit tests. --- src/routes/api/badges/+server.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/routes/api/badges') diff --git a/src/routes/api/badges/+server.ts b/src/routes/api/badges/+server.ts index 46b98cbc..2673273c 100644 --- a/src/routes/api/badges/+server.ts +++ b/src/routes/api/badges/+server.ts @@ -1,20 +1,20 @@ +import { Schema } from "effect"; import { safeUserIdentity } from "$lib/Data/AniList/identity"; -import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; -import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody"; import { - removeAllUserBadges, - removeUserBadge, - updateUserBadge, - getUserBadges, addUserBadge, type Badge, type BadgeInput, + getUserBadges, + incrementClickCount, migrateCategory, + removeAllUserBadges, + removeUserBadge, setShadowHidden, setShadowHiddenBadge, - incrementClickCount, + updateUserBadge, } from "$lib/Database/SB/User/badges"; -import { Schema } from "effect"; +import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; +import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody"; import { appOrigin, appOriginHeaders } from "$lib/Utility/appOrigin"; import privilegedUser from "$lib/Utility/privilegedUser"; @@ -118,7 +118,7 @@ export const PUT = async ({ cookies, url, request }) => { .map(async (badge) => { await updateUserBadge(identity.id, badge.id as number, { ...badge, - hidden: + hidden: !( allBadges .filter( (badge) => @@ -130,8 +130,7 @@ export const PUT = async ({ cookies, url, request }) => { badge.category === (url.searchParams.get("category") || ""), ).length / 2 - ? false - : true, + ), }); }), ); @@ -144,7 +143,7 @@ export const PUT = async ({ cookies, url, request }) => { await setShadowHiddenBadge( Number(url.searchParams.get("shadowHideBadge")), - url.searchParams.get("status") === "true" ? false : true, + url.searchParams.get("status") !== "true", ); return await badges(Number(url.searchParams.get("id"))); -- cgit v1.2.3