fix: Fix lint errors (#559)

* cleanup: postactions styling

* misc: fix first round of errors

* pkg: remove vitest

* fix: fix lint errors stage 2

* fix: fix lint errors stage 3

* fix: fix lint errors, stage 3

* misc: update eslint rules to warn for writable derived
This commit is contained in:
Xylight authored and GitHub committed 2025-06-09 16:34:06 -07:00
1 parent 1824245f13
commit 76c581123a
225 files changed
+1553 -2352

No files matched your search

@@ -1,27 +1,22 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import Entity from '$lib/components/ui/Entity.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations.js'
import { getClient } from '$lib/lemmy.svelte.js'
import type {
CommunityBlockView,
InstanceBlockView,
PersonBlockView,
} from 'lemmy-js-client'
import type { PageData } from './$types.js'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { getClient } from '$lib/lemmy.svelte.js'
import { profile } from '$lib/auth.svelte.js'
import { Check, Icon, Trash, XMark } from 'svelte-hero-icons'
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
import { flip } from 'svelte/animate'
import { slide } from 'svelte/transition'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
import { Button } from 'mono-svelte'
import Entity from '$lib/components/ui/Entity.svelte'
import { t } from '$lib/i18n/translations.js'
import Switch from '$lib/components/input/Switch.svelte'
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
import { expoOut } from 'svelte/easing'
import Material from 'mono-svelte/materials/Material.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { Check, Icon, XMark } from 'svelte-hero-icons'
import type { PageData } from './$types.js'
interface Props {
// sveltekit doesn't feel like making types work right now
@@ -38,7 +33,7 @@
if (!profile.data?.jwt) return
data.person_blocks.splice(
data.person_blocks.findIndex((i) => i.target.id == item.target.id),
data.person_blocks.findIndex(i => i.target.id == item.target.id),
1,
)
// hack to get reactivity working
@@ -54,9 +49,7 @@
if (!profile.data?.jwt) return
data.community_blocks.splice(
data.community_blocks.findIndex(
(i) => i.community.id == item.community.id,
),
data.community_blocks.findIndex(i => i.community.id == item.community.id),
1,
)
@@ -75,7 +68,7 @@
data.my_user.instance_blocks.splice(
data.my_user.instance_blocks.findIndex(
(i) => i.instance.id == item.instance.id,
i => i.instance.id == item.instance.id,
),
1,
)
@@ -1,10 +1,9 @@
<script>
import { t } from '$lib/i18n/translations'
import { Button } from 'mono-svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { page } from '$app/state'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
@@ -38,11 +37,11 @@
</script>
<Header pageHeader>
{routes.find((r) => page.url.pathname == r.url)?.name}
{routes.find(r => page.url.pathname == r.url)?.name}
</Header>
<div class="flex flex-row gap-12">
<nav class="flex flex-col gap-2 flex-1 max-sm:hidden">
{#each routes as route}
{#each routes as route (route)}
<SidebarButton
size="lg"
rounding="lg"
@@ -1,17 +1,16 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { page } from '$app/state'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { client } from '$lib/lemmy.svelte.js'
import { t } from '$lib/i18n/translations.js'
import { qr } from '@svelte-put/qr/svg'
import { Button, Material, TextInput, toast } from 'mono-svelte'
import { ClipboardDocument, Icon } from 'svelte-hero-icons'
import { errorMessage } from '$lib/lemmy/error.js'
let { data } = $props()
// @ts-ignore
let totpLink: string | undefined = $state(undefined)
let totpLink = $state<string>()
let totpEnabled = $state(
data.my_user?.local_user_view.local_user.totp_2fa_enabled,
)
@@ -38,7 +37,7 @@
totpEnabled = true
}
} catch (e) {
toast({ content: e as any, type: 'error' })
toast({ content: errorMessage(e as string), type: 'error' })
}
}
</script>
@@ -77,10 +76,7 @@
</span>
</TextInput>
{/if}
<form
class="flex flex-col gap-2 w-full"
onsubmit={(e) => e.preventDefault()}
>
<form class="flex flex-col gap-2 w-full" onsubmit={e => e.preventDefault()}>
<TextInput
bind:value={verify_totp}
placeholder="012345"
@@ -3,7 +3,6 @@
import { deleteProfile, profile, setUser } from '$lib/auth.svelte'
import { client } from '$lib/lemmy.svelte'
import { instance as currentInstance } from '$lib/instance.svelte'
import { t } from '$lib/i18n/translations'
import { Button, TextInput, toast } from 'mono-svelte'
import { errorMessage } from '$lib/lemmy/error'
@@ -25,7 +24,6 @@
const { instance, username } = profile.data
deleteProfile(profile.data.id)
await setUser(res.jwt, instance, username!)
$currentInstance = instance
toast({ content: $t('toast.loginRefresh'), type: 'success' })
} else {
@@ -35,7 +33,7 @@
toast({ content: $t('toast.passwordReset') })
} catch (e) {
toast({
content: errorMessage(e as any),
content: errorMessage(e as string),
type: 'error',
})
}
@@ -71,7 +71,7 @@
})
profileData.profiles.splice(
profileData.profiles.findIndex((p) => profileData.profile == p.id),
profileData.profiles.findIndex(p => profileData.profile == p.id),
)
setUserID(-1)
@@ -81,7 +81,7 @@
goto('/')
} catch (err) {
toast({
content: err as any,
content: err as string,
type: 'error',
})
} finally {
@@ -1,17 +1,11 @@
<script lang="ts">
import { publishedToDate } from '$lib/components/util/date.js'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { client } from '$lib/lemmy.svelte.js'
import { Checkbox, Material } from 'mono-svelte'
import { Icon, Key } from 'svelte-hero-icons'
import { Material } from 'mono-svelte'
import { UAParser } from 'ua-parser-js'
let { data } = $props()
let checked: {
[token: string]: boolean
} = $state({})
</script>
<Material
@@ -37,7 +31,7 @@
class="divide-y *:h-14 divide-slate-200 dark:divide-zinc-800 bg-white dark:bg-zinc-950
"
>
{#each data.tokens as token}
{#each data.tokens as token (token)}
{@const ua = new UAParser(token.user_agent).getResult()}
<tr class="divide-x *:px-3 divide-slate-200 dark:divide-zinc-800">
<td>
@@ -1,8 +1,6 @@
import { client } from '$lib/lemmy.svelte.js'
export async function load({ fetch, parent }) {
const user = await parent()
export async function load({ fetch }) {
const response = await client({ func: fetch }).listLogins()
return {
@@ -1,26 +1,27 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy'
import { profile, profileData, setUserID } from '$lib/auth.svelte.js'
import { profile } from '$lib/auth.svelte.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations.js'
import { getClient, site } from '$lib/lemmy.svelte.js'
import { uploadImage } from '$lib/util.svelte.js'
import type { SaveUserSettings } from 'lemmy-js-client'
import {
Badge,
Button,
ImageInput,
Material,
Menu,
MenuButton,
removeToast,
Switch,
TextInput,
toast,
} from 'mono-svelte'
import { getClient, site } from '$lib/lemmy.svelte.js'
import type { SaveUserSettings } from 'lemmy-js-client'
import { Button, Switch, TextInput } from 'mono-svelte'
import { uploadImage } from '$lib/util.svelte.js'
import { t } from '$lib/i18n/translations.js'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import type { PageData } from './$types'
import { Icon, Plus } from 'svelte-hero-icons'
import type { PageData } from './$types'
interface Props {
inline?: boolean
@@ -61,7 +62,7 @@
)
: undefined
const res = await getClient().saveUserSettings({
await getClient().saveUserSettings({
...formData,
avatar: pfp,
banner: banner,
@@ -73,7 +74,7 @@
})
} catch (err) {
toast({
content: err as any,
content: err as string,
type: 'error',
})
}
@@ -142,7 +143,7 @@
</Badge>
</button>
{/snippet}
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language, index}
{#each site.data.all_languages.filter(l => !formData.discussion_languages?.includes(l.id)) as language (language.id)}
<MenuButton
class="min-h-[16px] py-0"
onclick={() => {
@@ -153,7 +154,7 @@
</MenuButton>
{/each}
</Menu>
{#each formData.discussion_languages as languageId, index}
{#each formData.discussion_languages as languageId, index (languageId)}
{@const language = site.data.all_languages.find(
l => l.id == languageId,
)}
+1 -5
View File
@@ -1,11 +1,7 @@
<script>
import { goto } from '$app/navigation'
import { page } from '$app/state'
import MultiSelect from '$lib/components/input/Switch.svelte'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import { site } from '$lib/lemmy.svelte'
import { t } from '$lib/i18n/translations'
import { site } from '$lib/lemmy.svelte'
import { feature } from '$lib/version'
import { Button, Menu, MenuButton } from 'mono-svelte'
import {
+3 -6
View File
@@ -1,13 +1,10 @@
import { profile } from '$lib/auth.svelte'
import { client, getClient } from '$lib/lemmy.svelte.js'
import { getItemPublished } from '$lib/lemmy/item.js'
import type { SortType } from 'lemmy-js-client'
import { get } from 'svelte/store'
import { client } from '$lib/lemmy.svelte.js'
// disable ssr, as the server cannot be authenticated
export let ssr = false
export const ssr = false
export async function load({ params, url, fetch }) {
export async function load({ fetch }) {
const my_user =
// profile.data?.user ??
(await client({ auth: profile.data?.jwt, func: fetch }).getSite()).my_user
+2 -3
View File
@@ -1,15 +1,14 @@
<script lang="ts">
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import EntityHeader from '$lib/components/ui/EntityHeader.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import { formatRelativeDate } from '$lib/components/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations.js'
import { communityLink } from '$lib/lemmy/generic.js'
import { settings } from '$lib/settings.svelte.js'
import { t } from '$lib/i18n/translations.js'
let { data } = $props()
let my_user = $derived(data.my_user!.local_user_view)
@@ -60,7 +59,7 @@
<hr class="flex-1 w-full border-slate-200 dark:border-zinc-800 mx-3" />
{/snippet}
<ItemList
items={data.moderates.map((m) => ({
items={data.moderates.map(m => ({
id: m.community.id,
name: m.community.title,
url: communityLink(m.community),
+3 -4
View File
@@ -3,10 +3,9 @@
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import Pageination from '$lib/components/ui/Pageination.svelte'
import { t } from '$lib/i18n/translations'
import { searchParam } from '$lib/util.svelte'
import { flip } from 'svelte/animate'
import { expoInOut } from 'svelte/easing'
import PictrsImage from './PictrsImage.svelte'
import { expoInOut, expoOut } from 'svelte/easing'
let { data = $bindable() } = $props()
</script>
@@ -20,7 +19,7 @@
ondelete={() => {
data.images = data.images.toSpliced(
data.images.findIndex(
(i) =>
i =>
i.local_image.pictrs_delete_token ==
image.local_image.pictrs_delete_token,
),
@@ -34,7 +33,7 @@
{#if data.images.length == 20}
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={(page) => `?page=${page}`}
href={page => `?page=${page}`}
/>
{/if}
+1 -1
View File
@@ -4,7 +4,7 @@ import { client } from '$lib/lemmy.svelte.js'
export async function load({ fetch, url }) {
const { jwt } = profile.data
let page = Number(url.searchParams.get('page')) || 1
const page = Number(url.searchParams.get('page')) || 1
const res = await client({ func: fetch, auth: jwt }).listMedia({
limit: 20,
+4 -5
View File
@@ -2,14 +2,13 @@
import { profile } from '$lib/auth.svelte'
import { publishedToDate } from '$lib/components/util/date'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations'
import { instance } from '$lib/instance.svelte'
import { client } from '$lib/lemmy.svelte'
import { t } from '$lib/i18n/translations'
import { instanceToURL } from '$lib/util.svelte'
import type { LocalImage } from 'lemmy-js-client'
import { Button, Material, toast } from 'mono-svelte'
import { createEventDispatcher } from 'svelte'
import { ArrowDown, ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
import { Button, toast } from 'mono-svelte'
import { ArrowDownTray, Icon, Trash } from 'svelte-hero-icons'
let loading = $state(false)
@@ -25,7 +24,7 @@
ondelete?.(res)
} catch (e) {
toast({ content: e as any, type: 'error' })
toast({ content: e as string, type: 'error' })
}
loading = false
}
-1
View File
@@ -1,4 +1,3 @@
import { client } from '$lib/lemmy.svelte.js'
import { postFeed } from '$lib/lemmy/postfeed.svelte.js'
import { error } from '@sveltejs/kit'