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:
1 parent
1824245f13
commit
76c581123a
225 files changed
+1553
-2352
No files matched your search
@@ -1,15 +1,6 @@
|
||||
import {
|
||||
derived,
|
||||
get,
|
||||
writable,
|
||||
type Updater,
|
||||
type Writable,
|
||||
type Readable,
|
||||
} from 'svelte/store'
|
||||
import { browser } from '$app/environment'
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { getDefaultTheme, presets } from './presets'
|
||||
import { browser } from '$app/environment'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
|
||||
type ColorScheme = 'system' | 'light' | 'dark'
|
||||
|
||||
@@ -62,7 +53,7 @@ export function rgbToHex(rgbString: string): string {
|
||||
return rgbString
|
||||
}
|
||||
|
||||
const [r, g, b] = rgb.map((val) => {
|
||||
const [r, g, b] = rgb.map(val => {
|
||||
const num = parseInt(val, 10)
|
||||
if (isNaN(num) || num < 0 || num > 255) {
|
||||
return 0
|
||||
@@ -80,7 +71,7 @@ export function rgbToHex(rgbString: string): string {
|
||||
$effect.root(() => {
|
||||
$effect(() => {
|
||||
if (browser) {
|
||||
const filteredThemes = theme.data.themes.filter((t) => t.id > 0)
|
||||
const filteredThemes = theme.data.themes.filter(t => t.id > 0)
|
||||
localStorage.setItem(
|
||||
'theme.data',
|
||||
JSON.stringify({
|
||||
@@ -127,7 +118,7 @@ class ThemeState {
|
||||
},
|
||||
)
|
||||
#current = $derived(
|
||||
this.#data.themes.find((i) => i.id == this.#data.currentTheme) ??
|
||||
this.#data.themes.find(i => i.id == this.#data.currentTheme) ??
|
||||
getDefaultTheme(),
|
||||
)
|
||||
#colorScheme = $state<ColorScheme>(configuredColorScheme as ColorScheme)
|
||||
@@ -138,7 +129,7 @@ class ThemeState {
|
||||
}
|
||||
set current(value) {
|
||||
if (!value) return
|
||||
const index = this.#data.themes.findIndex((i) => i.id == value?.id)
|
||||
const index = this.#data.themes.findIndex(i => i.id == value?.id)
|
||||
this.#data.themes[index] = value
|
||||
}
|
||||
|
||||
@@ -161,7 +152,7 @@ class ThemeState {
|
||||
}
|
||||
}
|
||||
|
||||
export let theme = new ThemeState()
|
||||
export const theme = new ThemeState()
|
||||
|
||||
export function calculateVars(theme: Theme) {
|
||||
let cssVariables = ''
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ export const isImage = (url: string | undefined) => {
|
||||
if (!url) return false
|
||||
|
||||
return /\.(jpeg|jpg|gif|png|svg|bmp|webp|avif)/i.test(url)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export const isVideo = (url: string | undefined) => {
|
||||
if (!url) return false
|
||||
|
||||
return /\.(mp4|mov|webm|mkv|avi)/i.test(url)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user