From 79104c5592656af92be9cd3794e6d47aff1f4fe8 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Wed, 07 Sep 2022 22:50:51 +0100 Subject: [PATCH] Run svelte-check in CI --- chartered-frontend/package.json | 2 +- chartered-frontend/src/global.d.ts | 5 ----- chartered-frontend/src/util.ts | 5 +++++ chartered-frontend/src/components/Icon.svelte | 6 +++--- chartered-frontend/src/components/Nav.svelte | 22 +++++++++++++++++++--- chartered-frontend/src/stores/auth.ts | 14 +++++++++++--- chartered-frontend/src/types/crate.ts | 25 +++++++++++++++++++++++++ chartered-frontend/src/types/organisations.ts | 7 ------- chartered-frontend/src/types/ssh_keys.ts | 2 +- chartered-frontend/src/types/user.ts | 10 ++++++++++ chartered-frontend/src/routes/(unauthed)/+layout.svelte | 2 +- chartered-frontend/src/routes/(authed)/search/+page.svelte | 3 ++- chartered-frontend/src/routes/(authed)/ssh-keys/CreateKeyForm.svelte | 7 ++++--- chartered-frontend/src/routes/(authed)/ssh-keys/DeleteSshKeyModal.svelte | 9 +++++---- chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte | 13 +++++++------ chartered-frontend/src/routes/(authed)/crates/[organisation]/AddMember.svelte | 20 ++++++++------------ chartered-frontend/src/routes/(authed)/crates/[organisation]/Member.svelte | 10 ++++++---- chartered-frontend/src/routes/(authed)/organisations/create/+page.svelte | 5 +++-- chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte | 2 +- chartered-frontend/src/routes/(authed)/sessions/list/+page.svelte | 2 +- chartered-frontend/src/routes/(authed)/sessions/list/DeleteSessionModal.svelte | 9 +++++---- chartered-frontend/src/routes/(authed)/users/[uuid]/+page.svelte | 4 ++-- chartered-frontend/src/routes/(unauthed)/auth/login/+page.svelte | 7 ++++--- chartered-frontend/src/routes/(unauthed)/auth/register/+page.svelte | 5 +++-- chartered-frontend/src/routes/(unauthed)/login/oauth/+page.svelte | 2 +- chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/+page.svelte | 8 ++++---- chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/Dependency.svelte | 8 ++++---- chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/MemberTab.svelte | 7 ++++--- 28 files changed, 139 insertions(+), 82 deletions(-) diff --git a/chartered-frontend/package.json b/chartered-frontend/package.json index 002092f..f0de21a 100644 --- a/chartered-frontend/package.json +++ a/chartered-frontend/package.json @@ -9,7 +9,7 @@ "test": "playwright test", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --check . && eslint .", + "lint": "prettier --check . && eslint . && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "format": "prettier --write ." }, "devDependencies": { diff --git a/chartered-frontend/src/global.d.ts b/chartered-frontend/src/global.d.ts deleted file mode 100644 index d79cb03..0000000 100644 --- a/chartered-frontend/src/global.d.ts +++ /dev/null @@ -1,5 +1,0 @@ -declare global { - interface Window { - extendSessionInterval: nodejs.Timer; - } -} diff --git a/chartered-frontend/src/util.ts b/chartered-frontend/src/util.ts new file mode 100644 index 0000000..0ab5645 100644 --- /dev/null +++ a/chartered-frontend/src/util.ts @@ -1,0 +1,5 @@ +export function getErrorMessage(error: unknown) { + if (error instanceof Error) return error.message; + + return String(error); +} diff --git a/chartered-frontend/src/components/Icon.svelte b/chartered-frontend/src/components/Icon.svelte index 7d687fa..96e3425 100644 --- a/chartered-frontend/src/components/Icon.svelte +++ a/chartered-frontend/src/components/Icon.svelte @@ -1,11 +1,11 @@ (userDropdownShown = false)} /> @@ -68,8 +82,8 @@ class="ml-2 relative flex items-center text-gray-300 dark:text-inherit" > Open user menu - {#if $auth.picture_url} - You + {#if $auth?.picture_url} + You {:else}
(e.target.tagName.toLowerCase() === 'a' ? null : e.stopPropagation())} + on:click={handleDropdownClick} >