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(-)
@@ -1,0 +1,5 @@
declare global {
interface Window {
extendSessionInterval: nodejs.Timer;
}
}
@@ -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
@@ -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"
@@ -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">
@@ -91,9 +91,9 @@
}
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();
if (json.error) {
@@ -241,14 +241,14 @@
*/
export async function register(username: string, password: string) {
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();
if (json.error) {
@@ -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;
@@ -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';
@@ -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>
@@ -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;
}
@@ -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';
@@ -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
@@ -138,6 +138,7 @@
Yes, I'm sure
</button>
<button
on:click={closeModal}
autofocus
@@ -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>
@@ -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"
/>
@@ -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;
}
@@ -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}
@@ -131,6 +131,7 @@
Yes, I'm sure
</button>
<button
on:click={closeModal}
autofocus
@@ -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"
@@ -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;
}
@@ -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;
}
@@ -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}
@@ -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]"
/>