aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Data/AniList/wrapped.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-05-29 23:44:08 +0000
committerFuwn <[email protected]>2026-05-29 23:44:08 +0000
commit49879c43ebd9f36ec19f4c02fa2b121314126286 (patch)
treebbf1e42eba5996640ffcc7f44d07245cdf2c5e5c /src/lib/Data/AniList/wrapped.ts
parentchore(biome): scope linting to remove Svelte false positives (diff)
downloaddue.moe-49879c43ebd9f36ec19f4c02fa2b121314126286.tar.xz
due.moe-49879c43ebd9f36ec19f4c02fa2b121314126286.zip
style: apply biome autofixes and resolve remaining lint findingsHEADmain
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.
Diffstat (limited to 'src/lib/Data/AniList/wrapped.ts')
-rw-r--r--src/lib/Data/AniList/wrapped.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/Data/AniList/wrapped.ts b/src/lib/Data/AniList/wrapped.ts
index a7b4f829..130c57d3 100644
--- a/src/lib/Data/AniList/wrapped.ts
+++ b/src/lib/Data/AniList/wrapped.ts
@@ -89,15 +89,15 @@ const profileActivities = async (
let response = await get(page);
const beginningOfYear = new Date(now).setMonth(0, 1) / 1000;
- pages.push(response["data"]["Page"]["activities"]);
+ pages.push(response.data.Page.activities);
- while (response["data"]["Page"]["pageInfo"]["hasNextPage"]) {
+ while (response.data.Page.pageInfo.hasNextPage) {
if (disableLoopingActivityCounter) break;
page += 1;
response = await get(page);
- pages.push(response["data"]["Page"]["activities"]);
+ pages.push(response.data.Page.activities);
}
return {
@@ -133,8 +133,7 @@ export const wrapped = async (
};
if (anilistAuthorisation) {
- headers["Authorization"] =
- `${anilistAuthorisation.tokenType} ${anilistAuthorisation.accessToken}`;
+ headers.Authorization = `${anilistAuthorisation.tokenType} ${anilistAuthorisation.accessToken}`;
}
const wrappedResponse = await (
@@ -178,12 +177,12 @@ export const wrapped = async (
}
return {
- statistics: wrappedResponse["data"]["User"]["statistics"],
+ statistics: wrappedResponse.data.User.statistics,
activities: {
statusCount: statusCountActivities,
messageCount: messageCountActivities,
},
- avatar: wrappedResponse["data"]["User"]["avatar"],
+ avatar: wrappedResponse.data.User.avatar,
};
};
@@ -222,7 +221,7 @@ export const tops = (
} = {};
media.forEach((m) => {
- if (m.mediaListEntry && m.mediaListEntry.score) {
+ if (m.mediaListEntry?.score) {
m.genres.forEach((genre) => {
if (!genresMap[genre])
genresMap[genre] = { totalScore: 0, count: 0, minutesWatched: 0 };