[dep] update to eslint 9

This commit is contained in:
Purp1e
2024-11-11 10:04:00 +08:00
parent e308309fb8
commit b1d505fd6b
36 changed files with 353 additions and 218 deletions

View File

@@ -1,20 +1,18 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { StateStorage } from 'zustand/middleware'
import { Store } from "@tauri-apps/plugin-store"
import { throttle } from 'throttle-debounce';
import { throttle } from "throttle-debounce"
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import type { StateStorage } from "zustand/middleware"
// import { useThrottleFn } from '@reactuses/core';
// 节流设置
export const THROTTLE_TIME = 300
export const THROTTLE_TIME_STORE = 5000
export const THROTTLE_LEADING = true
export const THROTTLE_TRAILING = true
// 自定义Store覆盖get, set等方法以适应tauri+zustand
export function tauriStore(name: string) {
const store = new Store(`${name || "store"}.settings.json`)
export async function tauriStore(name: string) {
const store = await Store.load(`${name || "store"}.settings.json`)
// 自动保存
const autoSave = throttle(
@@ -24,8 +22,8 @@ export function tauriStore(name: string) {
},
{
noTrailing: !THROTTLE_TRAILING,
noLeading: !THROTTLE_LEADING
}
noLeading: !THROTTLE_LEADING,
},
)
const doSet = throttle(
@@ -35,8 +33,8 @@ export function tauriStore(name: string) {
},
{
noTrailing: !THROTTLE_TRAILING,
noLeading: !THROTTLE_LEADING
}
noLeading: !THROTTLE_LEADING,
},
)
const set = (key: string, value: unknown) => {