From 99d4a8d1d518cd3bf38ffa7bfa5fdea4399a1e0e Mon Sep 17 00:00:00 2001 From: pa Date: Sun, 21 Dec 2025 01:05:04 +0900 Subject: [PATCH] jsconfig --- jsconfig.json | 8 ++++---- src-electron/jsconfig.json | 18 ++++++++++++++++++ src/jsconfig.json | 20 ++++++++++++++++++++ src/service/request.js | 2 +- src/stores/favorite.js | 19 ++++++++++++------- 5 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 src-electron/jsconfig.json create mode 100644 src/jsconfig.json diff --git a/jsconfig.json b/jsconfig.json index bb7aeeea..6765f276 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -4,15 +4,15 @@ "target": "ESNext", "allowJs": true, "checkJs": true, - "jsx": "preserve", "allowSyntheticDefaultImports": true, "esModuleInterop": true, "skipLibCheck": true, "moduleResolution": "bundler", "forceConsistentCasingInFileNames": true, - "lib": ["esnext", "dom", "dom.iterable"], - "types": ["vite/client", "element-plus/global", "node"] + "lib": ["esnext"], + "types": ["node"], + "noEmit": true }, - "include": ["src/**/*", "src-electron/**/*"], + "include": ["src/vite.config.js", "src/shared/utils/localizationHelperCLI.js"], "exclude": ["node_modules", "build"] } diff --git a/src-electron/jsconfig.json b/src-electron/jsconfig.json new file mode 100644 index 00000000..8cf68419 --- /dev/null +++ b/src-electron/jsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "module": "nodenext", + "target": "ES2022", + "allowJs": true, + "checkJs": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "moduleResolution": "nodenext", + "forceConsistentCasingInFileNames": true, + "lib": ["esnext", "dom"], + "types": ["node"], + "noEmit": true + }, + "include": ["**/*"], + "exclude": ["../node_modules", "../build"] +} diff --git a/src/jsconfig.json b/src/jsconfig.json new file mode 100644 index 00000000..859f3280 --- /dev/null +++ b/src/jsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "ESNext", + "target": "ESNext", + "allowJs": true, + "checkJs": true, + "jsx": "preserve", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "moduleResolution": "bundler", + "forceConsistentCasingInFileNames": true, + "lib": ["esnext", "dom", "dom.iterable"], + "types": ["vite/client", "element-plus/global"], + "resolveJsonModule": true, + "noEmit": true + }, + "include": ["**/*"], + "exclude": ["../node_modules", "../build", "vite.config.js", "shared/utils/localizationHelperCLI.js"] +} diff --git a/src/service/request.js b/src/service/request.js index 4a09a6e6..6389e1fb 100644 --- a/src/service/request.js +++ b/src/service/request.js @@ -196,7 +196,7 @@ export function request(endpoint, options) { if ( init.method === 'GET' && status === 404 && - endpoint.startsWith('avatars/') + endpoint?.startsWith('avatars/') ) { ElMessage({ message: t('message.api_handler.avatar_private_or_deleted'), diff --git a/src/stores/favorite.js b/src/stores/favorite.js index 45d578c0..590299db 100644 --- a/src/stores/favorite.js +++ b/src/stores/favorite.js @@ -8,8 +8,8 @@ import { removeFromArray, replaceReactiveObject } from '../shared/utils'; -import { database } from '../service/database'; import { avatarRequest, favoriteRequest } from '../api'; +import { database } from '../service/database'; import { processBulk } from '../service/request'; import { useAppearanceSettingsStore } from './settings/appearance'; import { useAvatarStore } from './avatar'; @@ -1258,7 +1258,10 @@ export const useFavoriteStore = defineStore('Favorite', () => { * @param {Function | null} onProgress - Progress callback function, receives (current, total) parameters * @returns {Promise<{total: number, invalid: number, invalidIds: string[]}>} */ - async function checkInvalidLocalAvatars(targetGroup = null, onProgress = null) { + async function checkInvalidLocalAvatars( + targetGroup = null, + onProgress = null + ) { const result = { total: 0, invalid: 0, @@ -1283,19 +1286,19 @@ export const useFavoriteStore = defineStore('Favorite', () => { if (!favoriteGroup || favoriteGroup.length === 0) { continue; } - + for (const favorite of favoriteGroup) { currentIndex++; - + if (typeof onProgress === 'function') { onProgress(currentIndex, result.total); } - + try { await avatarRequest.getAvatar({ avatarId: favorite.id }); - await new Promise(resolve => setTimeout(resolve, 500)); + await new Promise((resolve) => setTimeout(resolve, 500)); } catch (err) { result.invalid++; result.invalidIds.push(favorite.id); @@ -1329,7 +1332,9 @@ export const useFavoriteStore = defineStore('Favorite', () => { } for (const avatarId of avatarIds) { - const index = favoriteGroup.findIndex(fav => fav.id === avatarId); + const index = favoriteGroup.findIndex( + (fav) => fav.id === avatarId + ); if (index !== -1) { removeLocalAvatarFavorite(avatarId, group); result.removed++;