FIX lint error

This commit is contained in:
NanGua-QWQ
2026-02-22 17:10:12 +08:00
parent 7616a664a0
commit efa78f2bce
5 changed files with 23 additions and 16 deletions
+3 -1
View File
@@ -31,7 +31,9 @@ export default defineConfig(
'react-refresh/only-export-components': 'off', 'react-refresh/only-export-components': 'off',
'react-hooks/exhaustive-deps': 'warn', 'react-hooks/exhaustive-deps': 'warn',
'react-hooks/set-state-in-effect': 'off', 'react-hooks/set-state-in-effect': 'off',
'@typescript-eslint/no-require-imports': 'off' '@typescript-eslint/no-require-imports': 'off',
// we use TypeScript types instead of PropTypes in React components
'react/prop-types': 'off'
} }
}, },
eslintConfigPrettier eslintConfigPrettier
+3 -4
View File
@@ -337,9 +337,7 @@ export class HttpServerService extends Service {
} }
}) })
// ww // stray expression removed
this.app.use
// 404处理 // 404处理
this.app.use((_req: Request, res: Response) => { this.app.use((_req: Request, res: Response) => {
res.status(404).json({ res.status(404).json({
@@ -349,7 +347,8 @@ export class HttpServerService extends Service {
}) })
// 错误处理中间件 // 错误处理中间件
this.app.use((error: Error, _: Request, res: Response, __: NextFunction) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars
this.app.use((error: Error, _: Request, res: Response, _next: NextFunction) => {
this.mainCtx.logger.error(`HTTP server error: ${error.message}`) this.mainCtx.logger.error(`HTTP server error: ${error.message}`)
res.status(500).json({ res.status(500).json({
success: false, success: false,
@@ -29,15 +29,8 @@ export const TagEditorDialog: React.FC<TagEditorDialogProps> = ({
const themeMode = currentTheme?.mode || 'light' // 默认为 light const themeMode = currentTheme?.mode || 'light' // 默认为 light
useEffect(() => { // fetchAllTags is declared as a function so it can be called from useEffect
if (visible) { async function fetchAllTags() {
setSelectedTagIds(new Set(initialTagIds))
setInputValue('')
fetchAllTags()
}
}, [visible, initialTagIds])
const fetchAllTags = async () => {
if (!(window as any).api) return if (!(window as any).api) return
try { try {
const res = await (window as any).api.tagsGetAll() const res = await (window as any).api.tagsGetAll()
@@ -50,6 +43,14 @@ export const TagEditorDialog: React.FC<TagEditorDialogProps> = ({
} }
} }
useEffect(() => {
if (visible) {
setSelectedTagIds(new Set(initialTagIds))
setInputValue('')
fetchAllTags()
}
}, [visible, initialTagIds])
const handleAddTag = async () => { const handleAddTag = async () => {
const trimmed = inputValue.trim() const trimmed = inputValue.trim()
if (!trimmed) return if (!trimmed) return
@@ -29,7 +29,9 @@ const RandomTimeTrigger: React.FC<TriggerComponentProps> = ({ value, onChange })
const parsed = JSON.parse(value) const parsed = JSON.parse(value)
config = { ...config, ...parsed } config = { ...config, ...parsed }
} }
} catch {} } catch (e) {
console.debug('RandomTimeTrigger parse error', e)
}
const handleChange = (key: keyof RandomTimeConfig, v: any) => { const handleChange = (key: keyof RandomTimeConfig, v: any) => {
const numV = typeof v === 'number' ? v : v ? Number(v) : undefined const numV = typeof v === 'number' ? v : v ? Number(v) : undefined
+4 -1
View File
@@ -34,7 +34,10 @@ export const randomTimeTrigger: TriggerLogic = {
const parsed = JSON.parse(value) const parsed = JSON.parse(value)
config = { ...config, ...parsed } config = { ...config, ...parsed }
} }
} catch {} } catch (e) {
// swallow errors, use default config
console.debug('randomTimeTrigger calculateNextTime parse error', e)
}
const minHour = config.minHour ?? 0 const minHour = config.minHour ?? 0
const maxHour = config.maxHour ?? 23 const maxHour = config.maxHour ?? 23