From 21afdcb7410364bd794802332fe7612f898396eb Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Wed, 07 Sep 2022 20:42:37 +0100 Subject: [PATCH] Make npm run lint pass --- chartered-frontend/src/global.d.ts | 5 +++++ chartered-frontend/src/components/ErrorAlert.svelte | 2 +- chartered-frontend/src/components/Nav.svelte | 6 +----- chartered-frontend/src/components/Spinner.svelte | 2 +- chartered-frontend/src/stores/auth.ts | 14 ++++++++------ chartered-frontend/src/types/crate.ts | 2 +- chartered-frontend/src/routes/(authed)/+layout.svelte | 2 +- chartered-frontend/src/routes/(authed)/+page.svelte | 4 ++-- chartered-frontend/src/routes/(unauthed)/+layout.svelte | 2 +- chartered-frontend/src/routes/(authed)/ssh-keys/+page.svelte | 2 +- chartered-frontend/src/routes/(authed)/ssh-keys/CreateKeyForm.svelte | 2 +- chartered-frontend/src/routes/(authed)/ssh-keys/DeleteSshKeyModal.svelte | 1 + chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte | 2 +- chartered-frontend/src/routes/(authed)/crates/[organisation]/AddMember.svelte | 2 +- chartered-frontend/src/routes/(authed)/crates/[organisation]/Member.svelte | 4 ++-- chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte | 2 +- chartered-frontend/src/routes/(authed)/sessions/list/DeleteSessionModal.svelte | 1 + chartered-frontend/src/routes/(authed)/users/[uuid]/+page.svelte | 2 +- chartered-frontend/src/routes/(unauthed)/auth/login/+page.svelte | 2 +- chartered-frontend/src/routes/(unauthed)/auth/register/+page.svelte | 2 +- chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/Dependency.svelte | 4 ++-- chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/VersionTab.svelte | 2 +- 22 files changed, 35 insertions(+), 32 deletions(-) diff --git a/chartered-frontend/src/global.d.ts b/chartered-frontend/src/global.d.ts new file mode 100644 index 0000000..d79cb03 100644 --- /dev/null +++ a/chartered-frontend/src/global.d.ts @@ -1,0 +1,5 @@ +declare global { + interface Window { + extendSessionInterval: nodejs.Timer; + } +} diff --git a/chartered-frontend/src/components/ErrorAlert.svelte b/chartered-frontend/src/components/ErrorAlert.svelte index accf540..743ba41 100644 --- a/chartered-frontend/src/components/ErrorAlert.svelte +++ a/chartered-frontend/src/components/ErrorAlert.svelte @@ -5,7 +5,7 @@ /** * Sets whether the close button should be shown on this error alert. */ - export let showClose: boolean = true; + export let showClose = true; // create the event dispatcher, so we can tell the caller when the user attempts // to close the prompt, so it can clear the message and hide us from display diff --git a/chartered-frontend/src/components/Nav.svelte b/chartered-frontend/src/components/Nav.svelte index d331667..e50de2d 100644 --- a/chartered-frontend/src/components/Nav.svelte +++ a/chartered-frontend/src/components/Nav.svelte @@ -69,11 +69,7 @@ > Open user menu {#if $auth.picture_url} - Your profile picture + You {:else}
/** * Set whether this spinner should have `display: none`. */ - export let hidden: boolean = false; + export let hidden = false;
diff --git a/chartered-frontend/src/stores/auth.ts b/chartered-frontend/src/stores/auth.ts index a019136..cc03b11 100644 --- a/chartered-frontend/src/stores/auth.ts +++ a/chartered-frontend/src/stores/auth.ts @@ -91,9 +91,9 @@ } // start the cron loop to extend the session every minute -if (!(window as any).extendSessionInterval) { +if (!window.extendSessionInterval) { extendSession(); - (window as any).extendSessionInterval = setInterval(extendSession, 60000); + window.extendSessionInterval = setInterval(extendSession, 60000); } /** @@ -154,14 +154,14 @@ * @param url url (without base) to send request to */ export async function request(url: string): Promise { - let token = get(auth)?.auth_key; + const token = get(auth)?.auth_key; if (!token) { throw new Error('Not authenticated'); } - let result = await fetch(`${BASE_URL}/a/${token}${url}`); - let json: T & Error = await result.json(); + const result = await fetch(`${BASE_URL}/a/${token}${url}`); + const json: T & Error = await result.json(); // TODO: handle 404s if (json.error) { @@ -241,14 +241,14 @@ */ export async function register(username: string, password: string) { // send register request to backend - let result = await fetch(`${BASE_URL}/a/-/web/v1/auth/register/password`, { + const result = await fetch(`${BASE_URL}/a/-/web/v1/auth/register/password`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ username, password }), }); - let json: RegisterResult = await result.json(); + const json: RegisterResult = await result.json(); // throw an error if registration fails if (json.error) { diff --git a/chartered-frontend/src/types/crate.ts b/chartered-frontend/src/types/crate.ts index 76388c1..34be5a8 100644 --- a/chartered-frontend/src/types/crate.ts +++ a/chartered-frontend/src/types/crate.ts @@ -12,7 +12,7 @@ name: string; deps: VersionDependency[]; vers: string; - features: { [key: string]: any }; + features: { [key: string]: string[] }; size: number; created_at: string; uploader: VersionUploader; diff --git a/chartered-frontend/src/routes/(authed)/+layout.svelte b/chartered-frontend/src/routes/(authed)/+layout.svelte index 925ae75..56eb030 100644 --- a/chartered-frontend/src/routes/(authed)/+layout.svelte +++ a/chartered-frontend/src/routes/(authed)/+layout.svelte @@ -1,5 +1,5 @@