From 54a0dd7350abd6f4e2cea99bc985f2a850793c3d Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Sun, 4 May 2025 22:35:30 +0700 Subject: [PATCH] chore: Apply lint fixes --- src/data/RouterEvents.ts | 34 +++++++++++++++++----------------- src/data/api/index.ts | 16 ++++++++-------- src/data/api/settings.ts | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/data/RouterEvents.ts b/src/data/RouterEvents.ts index ed5cf07..29459a1 100644 --- a/src/data/RouterEvents.ts +++ b/src/data/RouterEvents.ts @@ -18,24 +18,24 @@ function makeStore(): Readable { return derived(page, ($page) => { return { navigating: false, target_url: $page.url }; }); - } else { - // On client. - let current = new URL(location.href); - - // Return store that responds to navigation events. - // The `navigating` store immediately "pushes" `null`. - // This in turn causes this derived store to immediately "push" the current URL. - return derived(navigating, ($nav) => { - let navigating = false; - // $nav is null when navigation finishes. - if ($nav != null && $nav.to != null) { - current = $nav.to.url; - navigating = true; - } - - return { navigating, target_url: current }; - }); } + + // On client. + let current = new URL(location.href); + + // Return store that responds to navigation events. + // The `navigating` store immediately "pushes" `null`. + // This in turn causes this derived store to immediately "push" the current URL. + return derived(navigating, ($nav) => { + let navigating = false; + // $nav is null when navigation finishes. + if ($nav != null && $nav.to != null) { + current = $nav.to.url; + navigating = true; + } + + return { navigating, target_url: current }; + }); } // Do not subscribe to it outside of components! diff --git a/src/data/api/index.ts b/src/data/api/index.ts index f9565cc..a5771fe 100644 --- a/src/data/api/index.ts +++ b/src/data/api/index.ts @@ -9,8 +9,7 @@ import type { DonationPlatform, CryptoWallet, Social, - About, - CompatiblePackage + About } from '$lib/types'; export type ContributorsData = { contributables: Contributable[] }; @@ -41,20 +40,21 @@ async function patches(): Promise { const json = await get_json('v4/patches/list'); const packagesWithCount: { [key: string]: number } = {}; - json.forEach((patch) => { - if (!patch.compatiblePackages) return; + for (const patch of json) { + if (!patch.compatiblePackages) continue; patch.compatiblePackages = Object.keys(patch.compatiblePackages).map((name) => ({ name, versions: patch.compatiblePackages[name] })); - }); + } // gets packages and patch count - for (let i = 0; i < json.length; i++) { - json[i].compatiblePackages?.forEach((pkg: CompatiblePackage) => { + for (const { compatiblePackages } of json) { + if (!compatiblePackages) continue; + for (const pkg of compatiblePackages) { packagesWithCount[pkg.name] = (packagesWithCount[pkg.name] || 0) + 1; - }); + } } // sort packages by patch count to get most relevant apps on top diff --git a/src/data/api/settings.ts b/src/data/api/settings.ts index bfe6f77..0b81e7f 100644 --- a/src/data/api/settings.ts +++ b/src/data/api/settings.ts @@ -12,7 +12,7 @@ function set_status_url(apiUrl: string) { .then((data) => { if (data?.status) { localStorage.setItem(STATUS_KEY, data.status); - console.log('status is now ' + localStorage.getItem(STATUS_KEY)); + console.log('Status is now:', localStorage.getItem(STATUS_KEY)); } }); }