From 6aad9fd9452dfca603084dece2a7cd82adfbe262 Mon Sep 17 00:00:00 2001 From: matevip Date: Wed, 15 Jul 2026 14:26:27 +0800 Subject: [PATCH] fix(ui): resolve lint errors surfaced by the new ESLint config Use const for a never-reassigned local, drop an unused v-for index, add a default branch to an exhaustive switch the linter cannot prove, and remove eslint-disable directives that no longer match enabled rules. --- mateclaw-ui/src/components/workflow/WorkflowJsonEditor.vue | 1 - mateclaw-ui/src/composables/chat/useMessages.ts | 2 +- mateclaw-ui/src/composables/wikilink.ts | 1 - mateclaw-ui/src/views/ChatConsole.vue | 1 + mateclaw-ui/src/views/Wiki/components/JobStageBar.vue | 2 +- mateclaw-ui/src/views/mcp/icons.ts | 1 - 6 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mateclaw-ui/src/components/workflow/WorkflowJsonEditor.vue b/mateclaw-ui/src/components/workflow/WorkflowJsonEditor.vue index 88da4472..76c00384 100644 --- a/mateclaw-ui/src/components/workflow/WorkflowJsonEditor.vue +++ b/mateclaw-ui/src/components/workflow/WorkflowJsonEditor.vue @@ -162,7 +162,6 @@ function onEditorMount(editor: monaco.editor.IStandaloneCodeEditor) { // is needed because monaco's d.ts marks the static `languages.json` // namespace as deprecated even though it's still the official runtime // API for jsonDefaults.setDiagnosticsOptions in the v0.55.x line. - // eslint-disable-next-line @typescript-eslint/no-explicit-any const jsonLang = (monaco.languages as any).json if (jsonLang?.jsonDefaults) { jsonLang.jsonDefaults.setDiagnosticsOptions({ diff --git a/mateclaw-ui/src/composables/chat/useMessages.ts b/mateclaw-ui/src/composables/chat/useMessages.ts index 0fd792fd..842dd04c 100644 --- a/mateclaw-ui/src/composables/chat/useMessages.ts +++ b/mateclaw-ui/src/composables/chat/useMessages.ts @@ -132,7 +132,7 @@ export function useMessages(options: UseMessagesOptions = {}): UseMessagesReturn if (!message) return // 获取或创建对应类型的 contentPart - let contentParts = [...(message.contentParts || [])] + const contentParts = [...(message.contentParts || [])] const partIndex = contentParts.findLastIndex(p => p.type === type) if (partIndex === -1) { diff --git a/mateclaw-ui/src/composables/wikilink.ts b/mateclaw-ui/src/composables/wikilink.ts index 8ad1ec10..1de00ac9 100644 --- a/mateclaw-ui/src/composables/wikilink.ts +++ b/mateclaw-ui/src/composables/wikilink.ts @@ -53,7 +53,6 @@ const SKIP_TAGS = new Set(['PRE', 'CODE', 'KBD', 'SAMP']) * when someone wrote them literally instead of as escape text. If a real slug * needs a tab character, that is a backend bug worth surfacing. */ -// eslint-disable-next-line no-control-regex const DANGEROUS_CHAR_RE = /[<>"'`\n\r\x00-\x1F\x7F]/ /** Slug length cap. Backend `toSlug` produces slugs well under this. */ diff --git a/mateclaw-ui/src/views/ChatConsole.vue b/mateclaw-ui/src/views/ChatConsole.vue index 674873ce..5b6d8fd3 100644 --- a/mateclaw-ui/src/views/ChatConsole.vue +++ b/mateclaw-ui/src/views/ChatConsole.vue @@ -887,6 +887,7 @@ const modelPromptText = computed<{ title: string; desc: string }>(() => { case 'unprobed': return { title: t('chat.prompt.unprobed.title'), desc: t('chat.prompt.unprobed.desc') } case 'no-models': + default: return { title: t('chat.prompt.noModels.title', { name: p?.name || '' }), desc: t('chat.prompt.noModels.desc'), diff --git a/mateclaw-ui/src/views/Wiki/components/JobStageBar.vue b/mateclaw-ui/src/views/Wiki/components/JobStageBar.vue index a3c3033f..feec8fc1 100644 --- a/mateclaw-ui/src/views/Wiki/components/JobStageBar.vue +++ b/mateclaw-ui/src/views/Wiki/components/JobStageBar.vue @@ -16,7 +16,7 @@
diff --git a/mateclaw-ui/src/views/mcp/icons.ts b/mateclaw-ui/src/views/mcp/icons.ts index 845cdcd8..93291b33 100644 --- a/mateclaw-ui/src/views/mcp/icons.ts +++ b/mateclaw-ui/src/views/mcp/icons.ts @@ -10,7 +10,6 @@ * The catalog entry's `iconKey` must match the basename. */ -/* eslint-disable @typescript-eslint/no-explicit-any */ const rawSvgs = import.meta.glob('@/assets/icons/mcp/*.svg', { query: '?raw', import: 'default',