🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2022-09-07 20:42:37.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-09-07 20:42:37.0 +01:00:00
commit
21afdcb7410364bd794802332fe7612f898396eb [patch]
tree
fb6c37a89470289bb7751817c00c62536d0e63dc
parent
f234c05b8dc588e9d5d271f09a105257397aea51
download
21afdcb7410364bd794802332fe7612f898396eb.tar.gz

Make npm run lint pass



Diff

 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 @@
                >
                    <span class="sr-only">Open user menu</span>
                    {#if $auth.picture_url}
                        <img
                            alt="Your profile picture"
                            src={$auth.picture_url}
                            class="rounded-[50%] h-[2.4rem] inline mr-0.5"
                        />
                        <img alt="You" src={$auth.picture_url} class="rounded-[50%] h-[2.4rem] inline mr-0.5" />
                    {:else}
                        <div
                            class="h-[2.4rem] w-[2.4rem] rounded-[50%] inline mr-0.5 bg-gray-100 dark:bg-gray-800 overflow-hidden"
diff --git a/chartered-frontend/src/components/Spinner.svelte b/chartered-frontend/src/components/Spinner.svelte
index e7f9e28..676eb16 100644
--- a/chartered-frontend/src/components/Spinner.svelte
+++ a/chartered-frontend/src/components/Spinner.svelte
@@ -1,8 +1,8 @@
<script type="typescript">
    /**
     * Set whether this spinner should have `display: none`.
     */
    export let hidden: boolean = false;
    export let hidden = false;
</script>

<div class:hidden class="absolute top-0 left-0 w-full h-full flex items-center justify-center">
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<T>(url: string): Promise<T> {
    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 @@
<script type="typescript">
    import { auth, logout } from '../../stores/auth';
    import { auth } from '../../stores/auth';
    import { goto } from '$app/navigation';
    import Nav from '../../components/Nav.svelte';
    import NavItem from '../../components/NavItem.svelte';
diff --git a/chartered-frontend/src/routes/(authed)/+page.svelte b/chartered-frontend/src/routes/(authed)/+page.svelte
index 0e49408..65c64a1 100644
--- a/chartered-frontend/src/routes/(authed)/+page.svelte
+++ a/chartered-frontend/src/routes/(authed)/+page.svelte
@@ -1,7 +1,7 @@
<script type="typescript">
    import Icon from '../../components/Icon.svelte';
    import rustLogo from '../../img/rust.svg';
    import { BASE_URL, auth, request } from '../../stores/auth';
    import { request } from '../../stores/auth';
    import RelativeTime from '../../components/RelativeTime.svelte';
    import Spinner from '../../components/Spinner.svelte';
    import type { MostDownloaded, RecentlyCreated, RecentlyUpdated } from '../../types/featured_crate';
@@ -28,7 +28,7 @@
        </div>

        <div class="pr-6 order-first md:order-last pt-10 md:pt-0">
            <img class="w-[8rem]" src={rustLogo} />️️
            <img alt="Rust logo" class="w-[8rem]" src={rustLogo} />️️
        </div>
    </div>
</header>
diff --git a/chartered-frontend/src/routes/(unauthed)/+layout.svelte b/chartered-frontend/src/routes/(unauthed)/+layout.svelte
index 4032062..f5d4441 100644
--- a/chartered-frontend/src/routes/(unauthed)/+layout.svelte
+++ a/chartered-frontend/src/routes/(unauthed)/+layout.svelte
@@ -22,7 +22,7 @@
    </div>
{/if}

<style>
<style lang="postcss">
    main {
        @apply w-full mt-2 p-4 bg-white dark:bg-transparent border dark:border-slate-700 rounded relative;
    }
diff --git a/chartered-frontend/src/routes/(authed)/ssh-keys/+page.svelte b/chartered-frontend/src/routes/(authed)/ssh-keys/+page.svelte
index 807c7f6..d97546f 100644
--- a/chartered-frontend/src/routes/(authed)/ssh-keys/+page.svelte
+++ a/chartered-frontend/src/routes/(authed)/ssh-keys/+page.svelte
@@ -1,5 +1,5 @@
<script type="typescript">
    import { auth, BASE_URL, request } from '../../../stores/auth';
    import { request } from '../../../stores/auth';
    import Spinner from '../../../components/Spinner.svelte';
    import ErrorAlert from '../../../components/ErrorAlert.svelte';
    import SingleSshKey from './SingleSshKey.svelte';
diff --git a/chartered-frontend/src/routes/(authed)/ssh-keys/CreateKeyForm.svelte b/chartered-frontend/src/routes/(authed)/ssh-keys/CreateKeyForm.svelte
index f966390..43b73df 100644
--- a/chartered-frontend/src/routes/(authed)/ssh-keys/CreateKeyForm.svelte
+++ a/chartered-frontend/src/routes/(authed)/ssh-keys/CreateKeyForm.svelte
@@ -13,7 +13,7 @@
    /**
     * Binding to the ssh key text field, contains anything currently in there
     */
    let sshKey: string = '';
    let sshKey = '';

    /**
     * Simple boolean flag to determine if a key is currently being submitted, so we can
diff --git a/chartered-frontend/src/routes/(authed)/ssh-keys/DeleteSshKeyModal.svelte b/chartered-frontend/src/routes/(authed)/ssh-keys/DeleteSshKeyModal.svelte
index e02585b..873946b 100644
--- a/chartered-frontend/src/routes/(authed)/ssh-keys/DeleteSshKeyModal.svelte
+++ a/chartered-frontend/src/routes/(authed)/ssh-keys/DeleteSshKeyModal.svelte
@@ -138,6 +138,7 @@
                    Yes, I'm sure
                </button>

                <!-- svelte-ignore a11y-autofocus -->
                <button
                    on:click={closeModal}
                    autofocus
diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte
index 1e14d6e..7ded578 100644
--- a/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte
@@ -64,7 +64,7 @@
        </div>

        <div class="order-first md:order-last">
            <img src="http://placekitten.com/128/128" class="rounded-[50%]" />
            <img src="http://placekitten.com/128/128" alt="Placeholder" class="rounded-[50%]" />
        </div>
    </div>
</header>
diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/AddMember.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/AddMember.svelte
index ed84b46..5d515ad 100644
--- a/chartered-frontend/src/routes/(authed)/crates/[organisation]/AddMember.svelte
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/AddMember.svelte
@@ -74,7 +74,7 @@
                <button on:click={() => dispatchNewMember(result)} class="flex items-center">
                    {#if result.picture_url}
                        <img
                            alt="Your profile picture"
                            alt={result.display_name}
                            src={result.picture_url}
                            class="rounded-[50%] h-[4rem] w-[4rem] mr-4"
                        />
diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/Member.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/Member.svelte
index 8d7238f..716adc5 100644
--- a/chartered-frontend/src/routes/(authed)/crates/[organisation]/Member.svelte
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/Member.svelte
@@ -78,7 +78,7 @@
        <a href={`/users/${member.uuid}`} class="flex-grow flex items-center mr-10 card-header mb-2 md:mb-0">
            {#if member.picture_url}
                <img
                    alt="Your profile picture"
                    alt={member.display_name}
                    src={member.picture_url}
                    class="rounded-[50%] h-[2rem] mr-3 inline-block"
                />
@@ -137,7 +137,7 @@
    </div>
</div>

<style>
<style lang="postcss">
    .hide {
        @apply hidden md:block invisible;
    }
diff --git a/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte b/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte
index 2701b78..899b19d 100644
--- a/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte
+++ a/chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte
@@ -47,7 +47,7 @@
                    </div>

                    <div class="min-w-[48px]">
                        <img class="rounded-[50%]" src="http://placekitten.com/48/48" />
                        <img alt="Placeholder" class="rounded-[50%]" src="http://placekitten.com/48/48" />
                    </div>
                </a>
            {/each}
diff --git a/chartered-frontend/src/routes/(authed)/sessions/list/DeleteSessionModal.svelte b/chartered-frontend/src/routes/(authed)/sessions/list/DeleteSessionModal.svelte
index 28711e2..2a686fd 100644
--- a/chartered-frontend/src/routes/(authed)/sessions/list/DeleteSessionModal.svelte
+++ a/chartered-frontend/src/routes/(authed)/sessions/list/DeleteSessionModal.svelte
@@ -131,6 +131,7 @@
                    Yes, I'm sure
                </button>

                <!-- svelte-ignore a11y-autofocus -->
                <button
                    on:click={closeModal}
                    autofocus
diff --git a/chartered-frontend/src/routes/(authed)/users/[uuid]/+page.svelte b/chartered-frontend/src/routes/(authed)/users/[uuid]/+page.svelte
index 323c8ba..0da406b 100644
--- a/chartered-frontend/src/routes/(authed)/users/[uuid]/+page.svelte
+++ a/chartered-frontend/src/routes/(authed)/users/[uuid]/+page.svelte
@@ -57,7 +57,7 @@

            <div class="order-first md:order-last">
                {#if user.picture_url}
                    <img alt="Your profile picture" src={user.picture_url} class="rounded-[50%] h-[8rem] inline" />
                    <img alt={user.displayName} src={user.picture_url} class="rounded-[50%] h-[8rem] inline" />
                {:else}
                    <div
                        class="h-[8rem] w-[8rem] rounded-[50%] text-gray-300 bg-gray-100 dark:bg-gray-800 overflow-hidden"
diff --git a/chartered-frontend/src/routes/(unauthed)/auth/login/+page.svelte b/chartered-frontend/src/routes/(unauthed)/auth/login/+page.svelte
index 2ed4242..42b3c8e 100644
--- a/chartered-frontend/src/routes/(unauthed)/auth/login/+page.svelte
+++ a/chartered-frontend/src/routes/(unauthed)/auth/login/+page.svelte
@@ -119,7 +119,7 @@
    {/await}
</div>

<style>
<style lang="postcss">
    input {
        @apply w-full mb-2 px-2.5 pb-2.5 pt-5 bg-transparent border dark:border-slate-700 rounded border-inherit;
    }
diff --git a/chartered-frontend/src/routes/(unauthed)/auth/register/+page.svelte b/chartered-frontend/src/routes/(unauthed)/auth/register/+page.svelte
index a176500..447b523 100644
--- a/chartered-frontend/src/routes/(unauthed)/auth/register/+page.svelte
+++ a/chartered-frontend/src/routes/(unauthed)/auth/register/+page.svelte
@@ -78,7 +78,7 @@
    </form>
</div>

<style>
<style lang="postcss">
    input {
        @apply w-full mb-2 px-2.5 pb-2.5 pt-5 bg-transparent border dark:border-slate-700 rounded border-inherit;
    }
diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/Dependency.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/Dependency.svelte
index 5f289c7..9ac1d34 100644
--- a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/Dependency.svelte
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/Dependency.svelte
@@ -6,7 +6,7 @@
    export let dependency: VersionDependency;
    export { clazz as class };

    function getLocalDependencyOrganisation(registry: string): string {
    function getLocalDependencyOrganisation(): string {
        const s = dependency.registry.split('/');

        return s[s.length - 1];
@@ -19,7 +19,7 @@
            {dependency.name}
        </a>
    {:else if dependency.registry.indexOf('ssh://') === 0}
        <a href={`/crates/${getLocalDependencyOrganisation(dependency.registry)}/${dependency.name}`} target="_blank">
        <a href={`/crates/${getLocalDependencyOrganisation()}/${dependency.name}`} target="_blank">
            {dependency.name}
        </a>
    {:else}
diff --git a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/VersionTab.svelte b/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/VersionTab.svelte
index 2419344..761a785 100644
--- a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/VersionTab.svelte
+++ a/chartered-frontend/src/routes/(authed)/crates/[organisation]/[crate]/VersionTab.svelte
@@ -23,7 +23,7 @@

            {#if version.uploader.picture_url}
                <img
                    alt="Your profile picture"
                    alt={version.uploader.display_name}
                    src={version.uploader.picture_url}
                    class="rounded-[50%] h-[1rem] w-[1rem]"
                />