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,17 +1,18 @@
<script lang="ts">
import { run, preventDefault } from 'svelte/legacy'
import { preventDefault } from 'svelte/legacy'
import Avatar from '$lib/components/ui/Avatar.svelte'
import type { Community, Person, PersonView } from 'lemmy-js-client'
import type { Community, Person } from 'lemmy-js-client'
import { getClient } from '$lib/lemmy.svelte.js'
import { toast } from 'mono-svelte'
import { profile } from '$lib/auth.svelte.js'
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
import { Button, Checkbox, Modal } from 'mono-svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import CommunityLink from '../community/CommunityLink.svelte'
import Duration from '$lib/components/form/Duration.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { errorMessage } from '$lib/lemmy/error'
interface Props {
open?: boolean
@@ -84,7 +85,7 @@
item.banned = !banned
} catch (err) {
toast({
content: err as any,
content: errorMessage(err),
type: 'error',
})
}
@@ -16,7 +16,6 @@
interface Props {
item: PostView | CommentView
[key: string]: any
}
let { item = $bindable(), ...rest }: Props = $props()
@@ -1,9 +1,11 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte'
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
import type { CommentView, PostView } from 'lemmy-js-client'
import { amMod, ban, isAdmin, remove } from './moderation'
import { Button, Menu, MenuButton, MenuDivider, toast } from 'mono-svelte'
import {
ArrowsUpDown,
Fire,
Icon,
LockClosed,
@@ -12,16 +14,12 @@
ShieldExclamation,
Trash,
} from 'svelte-hero-icons'
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
import { Menu, MenuButton, MenuDivider, toast } from 'mono-svelte'
import { profile } from '$lib/auth.svelte.js'
import { Button } from 'mono-svelte'
import { t } from '$lib/i18n/translations'
import { amMod, ban, isAdmin, remove } from './moderation'
import ShieldIcon from './ShieldIcon.svelte'
import { errorMessage } from '$lib/lemmy/error'
interface Props {
item: PostView | CommentView
[key: string]: any
}
let { item = $bindable(), ...rest }: Props = $props()
@@ -44,7 +42,7 @@
item.post.locked = lock
} catch (err) {
toast({
content: err as any,
content: errorMessage(err),
type: 'error',
})
}
@@ -67,7 +65,7 @@
item.post.featured_community = pinned
} catch (err) {
toast({
content: err as any,
content: errorMessage(err),
type: 'error',
})
}
@@ -1,23 +1,23 @@
<script lang="ts">
import { run, preventDefault } from 'svelte/legacy'
import { preventDefault, run } from 'svelte/legacy'
import { profile } from '$lib/auth.svelte.js'
import MultiSelect from '$lib/components/input/Switch.svelte'
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
import Post from '$lib/components/lemmy/post/Post.svelte'
import { Select, Switch, toast } from 'mono-svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js'
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
import type { CommentView, PostView } from 'lemmy-js-client'
import { profile } from '$lib/auth.svelte.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { Fire, Icon, Trash } from 'svelte-hero-icons'
import MultiSelect from '$lib/components/input/Switch.svelte'
import { removalTemplate } from '$lib/components/lemmy/moderation/moderation.js'
import { settings } from '$lib/settings.svelte.js'
import { fullCommunityName } from '$lib/util.svelte.js'
import { amMod, isAdmin } from './moderation'
import { Button, Checkbox, Modal } from 'mono-svelte'
import { t } from '$lib/i18n/translations'
import type { CommentView, PostView } from 'lemmy-js-client'
import { Button, Modal, Select, Switch, toast } from 'mono-svelte'
import Option from 'mono-svelte/forms/select/Option.svelte'
import { Fire, Icon, Trash } from 'svelte-hero-icons'
import { amMod, isAdmin } from './moderation'
import { errorMessage } from '$lib/lemmy/error'
interface Props {
open: boolean
@@ -153,7 +153,7 @@
open = false
} catch (err) {
toast({
content: err as any,
content: errorMessage(err),
type: 'error',
})
}
@@ -1,22 +1,20 @@
<script lang="ts">
import { run, preventDefault } from 'svelte/legacy'
import { preventDefault, run } from 'svelte/legacy'
import { profile } from '$lib/auth.svelte.js'
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
import Post from '$lib/components/lemmy/post/Post.svelte'
import { toast } from 'mono-svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js'
import type {
CommentView,
PostView,
PrivateMessageView,
} from 'lemmy-js-client'
import { profile } from '$lib/auth.svelte.js'
import { Button, Modal } from 'mono-svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { onMount } from 'svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { t } from '$lib/i18n/translations'
import { Button, Modal, toast } from 'mono-svelte'
import PrivateMessage from '../inbox/PrivateMessage.svelte'
import { errorMessage } from '$lib/lemmy/error'
interface Props {
open: boolean
@@ -67,7 +65,7 @@
type: 'success',
})
} catch (err) {
toast({ content: err as any, type: 'error' })
toast({ content: errorMessage(err as string), type: 'error' })
}
loading = false
@@ -9,7 +9,7 @@ import type {
PostView,
PrivateMessageView,
} from 'lemmy-js-client'
import { get, writable } from 'svelte/store'
import { writable } from 'svelte/store'
interface Modals {
reporting: {
@@ -29,7 +29,7 @@ interface Modals {
}
}
export let modals = writable<Modals>({
export const modals = writable<Modals>({
reporting: {
open: false,
item: undefined,
@@ -48,7 +48,7 @@ export let modals = writable<Modals>({
})
export function report(item: PostView | CommentView | PrivateMessageView) {
modals.update((m) => ({
modals.update(m => ({
...m,
reporting: {
open: true,
@@ -58,7 +58,7 @@ export function report(item: PostView | CommentView | PrivateMessageView) {
}
export function remove(item: SubmissionView, purge: boolean = false) {
modals.update((m) => ({
modals.update(m => ({
...m,
removing: {
open: true,
@@ -69,7 +69,7 @@ export function remove(item: SubmissionView, purge: boolean = false) {
}
export function ban(banned: boolean, item: Person, community?: Community) {
modals.update((m) => ({
modals.update(m => ({
...m,
banning: {
open: true,
@@ -88,16 +88,13 @@ export async function feature(featured: boolean, item: Comment, jwt: string) {
}
export const amMod = (me: MyUserInfo, community: Community) =>
me.moderates.map((c) => c.community.id).includes(community.id) ||
me.moderates.map(c => c.community.id).includes(community.id) ||
(community.local && isAdmin(me))
export const amModOfAny = (me?: MyUserInfo) =>
me && (me.moderates.length > 0 || isAdmin(me))
export const isAdmin = (me: MyUserInfo) =>
// backwards compatibility hack
// @ts-ignore
me.local_user_view.local_user.admin ?? me.local_user_view.person?.admin
export const isAdmin = (me: MyUserInfo) => me.local_user_view.local_user.admin
export const removalTemplate = (
input: string,