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. --- .../api/animeschedule/oauth/callback/+server.ts | 2 +- src/routes/api/authentication/log-out/+server.ts | 2 +- src/routes/api/badges/+server.ts | 23 +++++++++++----------- .../api/myanimelist/oauth/callback/+server.ts | 2 +- src/routes/api/notifications/subscribe/+server.ts | 2 +- src/routes/api/oauth/callback/+server.ts | 2 +- src/routes/api/oauth/refresh/+server.ts | 2 +- src/routes/api/preferences/pin/+server.ts | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src/routes/api') diff --git a/src/routes/api/animeschedule/oauth/callback/+server.ts b/src/routes/api/animeschedule/oauth/callback/+server.ts index 294abc05..677aff68 100644 --- a/src/routes/api/animeschedule/oauth/callback/+server.ts +++ b/src/routes/api/animeschedule/oauth/callback/+server.ts @@ -1,6 +1,6 @@ -import { callback } from "$lib/Utility/oauth.js"; import { env } from "$env/dynamic/private"; import { env as env2 } from "$env/dynamic/public"; +import { callback } from "$lib/Utility/oauth.js"; export const GET = async ({ url, cookies }) => callback({ diff --git a/src/routes/api/authentication/log-out/+server.ts b/src/routes/api/authentication/log-out/+server.ts index c04fa5c5..8623dfd1 100644 --- a/src/routes/api/authentication/log-out/+server.ts +++ b/src/routes/api/authentication/log-out/+server.ts @@ -1,5 +1,5 @@ -import root from "$lib/Utility/root.js"; import { redirect } from "@sveltejs/kit"; +import root from "$lib/Utility/root.js"; export const GET = ({ cookies }) => { cookies.delete("user", { path: "/" }); 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"))); diff --git a/src/routes/api/myanimelist/oauth/callback/+server.ts b/src/routes/api/myanimelist/oauth/callback/+server.ts index 57a5fbe4..0fe774d9 100644 --- a/src/routes/api/myanimelist/oauth/callback/+server.ts +++ b/src/routes/api/myanimelist/oauth/callback/+server.ts @@ -1,6 +1,6 @@ -import { callback } from "$lib/Utility/oauth.js"; import { env } from "$env/dynamic/private"; import { env as env2 } from "$env/dynamic/public"; +import { callback } from "$lib/Utility/oauth.js"; export const GET = async ({ url, cookies }) => callback({ diff --git a/src/routes/api/notifications/subscribe/+server.ts b/src/routes/api/notifications/subscribe/+server.ts index 203470e0..51dbf340 100644 --- a/src/routes/api/notifications/subscribe/+server.ts +++ b/src/routes/api/notifications/subscribe/+server.ts @@ -1,8 +1,8 @@ +import { Schema } from "effect"; import { safeUserIdentity } from "$lib/Data/AniList/identity"; import { setUserSubscription } from "$lib/Database/SB/User/notifications"; import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; import { decodeRequestJsonOrThrow } from "$lib/Effect/requestBody"; -import { Schema } from "effect"; const unauthorised = new Response("Unauthorised", { status: 401 }); diff --git a/src/routes/api/oauth/callback/+server.ts b/src/routes/api/oauth/callback/+server.ts index c5faa859..96990bf0 100644 --- a/src/routes/api/oauth/callback/+server.ts +++ b/src/routes/api/oauth/callback/+server.ts @@ -1,6 +1,6 @@ -import { callback } from "$lib/Utility/oauth.js"; import { env } from "$env/dynamic/private"; import { env as env2 } from "$env/dynamic/public"; +import { callback } from "$lib/Utility/oauth.js"; export const GET = async ({ url, cookies }) => callback({ diff --git a/src/routes/api/oauth/refresh/+server.ts b/src/routes/api/oauth/refresh/+server.ts index 13e7ab09..d9e33f51 100644 --- a/src/routes/api/oauth/refresh/+server.ts +++ b/src/routes/api/oauth/refresh/+server.ts @@ -1,6 +1,6 @@ +import { redirect } from "@sveltejs/kit"; import { env } from "$env/dynamic/private"; import { env as env2 } from "$env/dynamic/public"; -import { redirect } from "@sveltejs/kit"; export const GET = async ({ url, cookies }) => { const formData = new FormData(); diff --git a/src/routes/api/preferences/pin/+server.ts b/src/routes/api/preferences/pin/+server.ts index b69a8142..118dd5ba 100644 --- a/src/routes/api/preferences/pin/+server.ts +++ b/src/routes/api/preferences/pin/+server.ts @@ -1,6 +1,6 @@ import { safeUserIdentity } from "$lib/Data/AniList/identity"; -import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; import { toggleHololiveStreamPinning } from "$lib/Database/SB/User/preferences"; +import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; import { appOriginHeaders } from "$lib/Utility/appOrigin"; const unauthorised = new Response("Unauthorised", { status: 401 }); -- cgit v1.2.3