fix: fix all eslint errors

This commit is contained in:
sam 2024-12-14 00:46:27 +01:00
parent 1cf2619393
commit 39a3098a99
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
19 changed files with 420 additions and 412 deletions

View file

@ -10,7 +10,7 @@ export default function createCallbackLoader(
bodyFn?: (event: ServerLoadEvent) => Promise<unknown>,
) {
return async (event: ServerLoadEvent) => {
const { url, parent, fetch, cookies } = event;
const { parent, fetch, cookies } = event;
bodyFn ??= async ({ url }) => {
const code = url.searchParams.get("code") as string | null;

View file

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export default class ApiError {
raw?: RawApiError;
code: ErrorCode;

View file

@ -23,7 +23,7 @@ export type RequestArgs = {
/**
* The body for this request, which will be serialized to JSON. Should be a plain JS object.
*/
body?: any;
body?: unknown;
/**
* The fetch function to use. Should be passed in loader and action functions, but can be safely ignored for client-side requests.
*/

View file

@ -21,6 +21,8 @@
{#if value !== ""}
<div class="card">
<div class="card-header">{$t("edit-profile.preview")}</div>
<!-- bios are sanitized before being passed to @html and the allowed markdown is heavily restricted -->
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
<div class="card-body">{@html renderMarkdown(value)}</div>
</div>
{/if}

View file

@ -47,6 +47,8 @@
{/if}
{#if bio}
<hr />
<!-- bios are sanitized before being passed to @html and the allowed markdown is heavily restricted -->
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
<p>{@html bio}</p>
{/if}
</div>

View file

@ -1,6 +1,7 @@
import { ErrorCode } from "$api/error";
import type { Modifier } from "sveltekit-i18n";
// eslint-disable-next-line
type TranslateFn = (key: string, payload?: any, props?: Modifier.Props<{}> | undefined) => any;
export default function errorDescription(t: TranslateFn, code: ErrorCode): string {

View file

@ -1,6 +1,7 @@
import { PUBLIC_LANGUAGE } from "$env/static/public";
import i18n, { type Config } from "sveltekit-i18n";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const config: Config<any> = {
initLocale: PUBLIC_LANGUAGE,
fallbackLocale: "en",

View file

@ -1,12 +1,12 @@
<script lang="ts">
import type { ActionData, PageData } from "./$types";
import type { ActionData } from "./$types";
import { t } from "$lib/i18n";
import { enhance } from "$app/forms";
import { Button, Input, InputGroup } from "@sveltestrap/sveltestrap";
import FormStatusMarker from "$components/editor/FormStatusMarker.svelte";
type Props = { data: PageData; form: ActionData };
let { data, form }: Props = $props();
type Props = { form: ActionData };
let { form }: Props = $props();
</script>
<svelte:head>

View file

@ -1,7 +1,7 @@
<script lang="ts">
import type { ActionData, PageData } from "./$types";
import { t } from "$lib/i18n";
import { Button, FormGroup, Icon, Input, InputGroup, Label } from "@sveltestrap/sveltestrap";
import { Button, FormGroup, Icon, Input, InputGroup } from "@sveltestrap/sveltestrap";
import Avatar from "$components/Avatar.svelte";
import { firstErrorFor } from "$api/error";
import Error from "$components/Error.svelte";

View file

@ -1,7 +1,6 @@
import { fastRequest } from "$api";
import ApiError, { ErrorCode, type RawApiError } from "$api/error.js";
import log from "$lib/log.js";
import { redirect } from "@sveltejs/kit";
export const load = async ({ parent }) => {
const { user } = await parent();

View file

@ -1,6 +1,5 @@
<script lang="ts">
import { t } from "$lib/i18n";
import { Button } from "@sveltestrap/sveltestrap";
import type { ActionData, PageData } from "./$types";
import FormStatusMarker from "$components/editor/FormStatusMarker.svelte";

View file

@ -1,8 +1,6 @@
<script lang="ts">
import { DateTime } from "luxon";
import type { ActionData, PageData } from "./$types";
import ErrorAlert from "$components/ErrorAlert.svelte";
import { Icon } from "@sveltestrap/sveltestrap";
import { t } from "$lib/i18n";
import { enhance } from "$app/forms";
import FormStatusMarker from "$components/editor/FormStatusMarker.svelte";

View file

@ -4,7 +4,7 @@ import type { PrideFlag } from "$api/models/user";
import log from "$lib/log";
import { encode } from "base64-arraybuffer";
export const load = async ({ url, fetch, cookies }) => {
export const load = async ({ fetch, cookies }) => {
const resp = await apiRequest<PrideFlag[]>("GET", "/users/@me/flags", { fetch, cookies });
return {

View file

@ -82,7 +82,7 @@ export const actions = {
},
options: async ({ params, request, fetch, cookies }) => {
const body = await request.formData();
let unlisted = !!body.get("unlisted");
const unlisted = !!body.get("unlisted");
try {
await fastRequest("PATCH", `/users/@me/members/${params.id}`, {

View file

@ -5,12 +5,11 @@
import { apiRequest, fastRequest } from "$api";
import ApiError from "$api/error";
import log from "$lib/log";
import { Icon, InputGroup } from "@sveltestrap/sveltestrap";
import { InputGroup } from "@sveltestrap/sveltestrap";
import InfoCircleFill from "svelte-bootstrap-icons/lib/InfoCircleFill.svelte";
import { t } from "$lib/i18n";
import AvatarEditor from "$components/editor/AvatarEditor.svelte";
import ErrorAlert from "$components/ErrorAlert.svelte";
import NoscriptWarning from "$components/editor/NoscriptWarning.svelte";
import FormStatusMarker from "$components/editor/FormStatusMarker.svelte";
import SidEditor from "$components/editor/SidEditor.svelte";
import BioEditor from "$components/editor/BioEditor.svelte";

View file

@ -11,7 +11,7 @@ export const actions = {
let timezone = body.get("timezone") as string | null;
if (!timezone || timezone === "") timezone = null;
let hideMemberList = !!body.get("hide-member-list");
const hideMemberList = !!body.get("hide-member-list");
try {
await fastRequest("PATCH", "/users/@me", {