mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-03-11 22:15:35 +00:00
feat: proper liting support
This commit is contained in:
parent
6b32ae67e3
commit
0f0cf183f9
16 changed files with 56 additions and 36 deletions
|
|
@ -23,8 +23,27 @@ export default tseslint.config(
|
|||
'newlines-between': 'always',
|
||||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type']
|
||||
}],
|
||||
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
||||
'@typescript-eslint/no-unused-vars': 'off'
|
||||
'@typescript-eslint/no-unnecessary-condition': 'warn'
|
||||
// '@typescript-eslint/no-unused-vars': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['**/*.svelte'],
|
||||
rules: {
|
||||
'no-unused-vars': ['error', {
|
||||
varsIgnorePattern: '.{2}(Events|Props)',
|
||||
args: 'none',
|
||||
caughtErrors: 'none',
|
||||
ignoreRestSiblings: true,
|
||||
vars: 'all'
|
||||
}],
|
||||
'@typescript-eslint/no-unused-vars': ['error', {
|
||||
varsIgnorePattern: '.{2}(Events|Props)',
|
||||
args: 'none',
|
||||
caughtErrors: 'none',
|
||||
ignoreRestSiblings: true,
|
||||
vars: 'all'
|
||||
}]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "eslint -c eslint.config.js",
|
||||
"lint:fix": "eslint -c eslint.config.js --fix",
|
||||
"lint": "eslint --quiet -c eslint.config.js",
|
||||
"lint:fix": "eslint --quiet -c eslint.config.js --fix",
|
||||
"gql:turbo": "node ./node_modules/gql.tada/bin/cli.js turbo",
|
||||
"gql:check": "node ./node_modules/gql.tada/bin/cli.js check",
|
||||
"gql:generate": "node --experimental-strip-types ./generateALIntrospection.ts"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
function filterSearch <T extends Array<[string, unknown]>> (repositories: T, input: string): T {
|
||||
if (!input) return repositories
|
||||
return repositories.filter(([id, _]) => id.toLowerCase().includes(input.toLowerCase())) as T
|
||||
return repositories.filter(([id]) => id.toLowerCase().includes(input.toLowerCase())) as T
|
||||
}
|
||||
|
||||
let extensionInput = ''
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
type $$Props = SelectPrimitive.ContentProps
|
||||
|
||||
let className: $$Props['class'] = ''
|
||||
let className: $$Props['class'] = undefined
|
||||
export let sideOffset: $$Props['sideOffset'] = 4
|
||||
export let inTransition: $$Props['inTransition'] = flyAndScale
|
||||
export let inTransitionConfig: $$Props['inTransitionConfig']
|
||||
export let inTransitionConfig: $$Props['inTransitionConfig'] = undefined
|
||||
export let outTransition: $$Props['outTransition'] = scale
|
||||
export let outTransitionConfig: $$Props['outTransitionConfig'] = {
|
||||
start: 0.95,
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
type $$Props = SelectPrimitive.ItemProps
|
||||
type $$Events = Required<SelectPrimitive.ItemEvents>
|
||||
|
||||
let className: $$Props['class'] = ''
|
||||
export let value: $$Props['value']
|
||||
export let label: $$Props['label']
|
||||
export let disabled: $$Props['disabled']
|
||||
let className: $$Props['class'] = undefined
|
||||
export let value: $$Props['value'] = undefined
|
||||
export let label: $$Props['label'] = undefined
|
||||
export let disabled: $$Props['disabled'] = undefined
|
||||
export { className as class }
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
side?: Side
|
||||
}
|
||||
|
||||
let className: $$Props['class']
|
||||
let className: $$Props['class'] = undefined
|
||||
export let side: $$Props['side'] = 'right'
|
||||
export { className as class }
|
||||
export let inTransition: $$Props['inTransition'] = fly
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
type $$Props = SheetPrimitive.DescriptionProps
|
||||
|
||||
let className: $$Props['class']
|
||||
let className: $$Props['class'] = undefined
|
||||
export { className as class }
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
type $$Props = HTMLAttributes<HTMLDivElement>
|
||||
|
||||
let className: $$Props['class']
|
||||
let className: $$Props['class'] = undefined
|
||||
export { className as class }
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
type $$Props = HTMLAttributes<HTMLDivElement>
|
||||
|
||||
let className: $$Props['class']
|
||||
let className: $$Props['class'] = undefined
|
||||
export { className as class }
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
type $$Props = SheetPrimitive.TitleProps
|
||||
|
||||
let className: $$Props['class']
|
||||
let className: $$Props['class'] = undefined
|
||||
export { className as class }
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@
|
|||
import { Button, type Props } from '$lib/components/ui/button'
|
||||
import { cn } from '$lib/utils.js'
|
||||
|
||||
type $$Props = Props & { href: string | null | undefined }
|
||||
type $$Props = Props & { disabled?: boolean | undefined | null }
|
||||
export let href: string | null | undefined = undefined
|
||||
export let disabled: $$Props['disabled'] = undefined
|
||||
|
||||
function matchPath (path: string, page: { url: URL }) {
|
||||
return page.url.pathname.startsWith(path)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
export { className as class }
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||
<thead class={cn('[&_tr]:border-b', className)} {...$$restProps} on:click on:keydown>
|
||||
<slot />
|
||||
</thead>
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ import { decryptMessage, encryptMessage } from './crypt'
|
|||
import type IrcChannel from '@thaunknown/web-irc/channel'
|
||||
import type { ChatMessage, ChatUser } from '$lib/components/ui/chat'
|
||||
|
||||
import { dev } from '$app/environment'
|
||||
|
||||
export interface IRCUser { nick: string, ident: string, hostname: string, modes: string[], tags: object }
|
||||
export interface PrivMessage {
|
||||
from_server: boolean
|
||||
|
|
@ -38,18 +36,18 @@ export default class MessageClient extends EventEmitter {
|
|||
this.ident = ident
|
||||
this.irc.on('userlist', async ({ users }: { users: IRCUser[] }) => {
|
||||
this.users.value = users.reduce((acc, user) => {
|
||||
const [nick, pfpid, pfpex] = user.nick.split('_')
|
||||
const [type, id] = user.ident.split('_')
|
||||
acc[user.ident] = { nick, id, pfpid: `${pfpid}.${pfpex}`, type: type as 'al' | 'guest' }
|
||||
const [nick, pfpid, pfpex] = user.nick.split('_') as [string, string, string]
|
||||
const [type, id] = user.ident.split('_') as ['al' | 'guest', string]
|
||||
acc[user.ident] = { nick, id, pfpid: `${pfpid}.${pfpex}`, type }
|
||||
return acc
|
||||
}, this.users.value)
|
||||
})
|
||||
|
||||
this.irc.on('join', async (user: IRCUser) => {
|
||||
try {
|
||||
const [nick, pfpid, pfpex] = user.nick.split('_')
|
||||
const [type, id] = user.ident.split('_')
|
||||
this.users.value[user.ident] = { nick, id, pfpid: `${pfpid}.${pfpex}`, type: type as 'al' | 'guest' }
|
||||
const [nick, pfpid, pfpex] = user.nick.split('_') as [string, string, string]
|
||||
const [type, id] = user.ident.split('_') as ['al' | 'guest', string]
|
||||
this.users.value[user.ident] = { nick, id, pfpid: `${pfpid}.${pfpex}`, type }
|
||||
this.users.update(users => users)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
|
@ -70,7 +68,7 @@ export default class MessageClient extends EventEmitter {
|
|||
try {
|
||||
this.messages.update(messages => [...messages, {
|
||||
message,
|
||||
user: this.users.value[priv.ident],
|
||||
user: this.users.value[priv.ident]!,
|
||||
type: 'incoming',
|
||||
date: new Date(priv.time)
|
||||
}])
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
const imported = JSON.parse(await navigator.clipboard.readText())
|
||||
$settings = imported
|
||||
native.restart()
|
||||
} catch (error) {
|
||||
} catch (err) {
|
||||
toast.error('Failed to import settings', {
|
||||
description: 'Failed to import settings from clipboard, make sure the copied data is valid JSON.',
|
||||
duration: 5000
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ import type { Config } from 'tailwindcss'
|
|||
|
||||
const config: Config = {
|
||||
plugins: [
|
||||
plugin(({ addVariant, matchVariant }) => {
|
||||
addVariant('select', ['&:hover', '&:focus-visible', '&:active'])
|
||||
addVariant('group-select', [':merge(.group):hover &', ':merge(.group):focus-visible &', ':merge(.group):active &'])
|
||||
addVariant('fullscreen', '&:fullscreen')
|
||||
addVariant('group-fullscreen', ':merge(.group):fullscreen &')
|
||||
matchVariant(
|
||||
plugin((api) => {
|
||||
api.addVariant('select', ['&:hover', '&:focus-visible', '&:active'])
|
||||
api.addVariant('group-select', [':merge(.group):hover &', ':merge(.group):focus-visible &', ':merge(.group):active &'])
|
||||
api.addVariant('fullscreen', '&:fullscreen')
|
||||
api.addVariant('group-fullscreen', ':merge(.group):fullscreen &')
|
||||
api.matchVariant(
|
||||
'group-fullscreen',
|
||||
(value, { modifier }) => [
|
||||
':merge(.group):fullscreen &',
|
||||
|
|
@ -18,7 +18,7 @@ const config: Config = {
|
|||
],
|
||||
{ values: { DEFAULT: undefined } }
|
||||
)
|
||||
matchVariant(
|
||||
api.matchVariant(
|
||||
'group-select',
|
||||
(value, { modifier }) => [
|
||||
':merge(.group):hover &',
|
||||
|
|
@ -30,7 +30,7 @@ const config: Config = {
|
|||
],
|
||||
{ values: { DEFAULT: undefined } }
|
||||
)
|
||||
addVariant('mobile', '@media (pointer: none), (pointer: coarse)')
|
||||
api.addVariant('mobile', '@media (pointer: none), (pointer: coarse)')
|
||||
})
|
||||
],
|
||||
darkMode: ['class'],
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@
|
|||
"src/**/*.svelte",
|
||||
"src/global.d.tsd.ts",
|
||||
"src/global.d.tsd.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"../node_modules/**"
|
||||
]
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
|
||||
|
|
|
|||
Loading…
Reference in a new issue