From 956a4541e9f65aa579edb749e4893fa46663090c Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Thu, 19 Mar 2026 14:27:23 +0800 Subject: [PATCH] style: lint --- docs/.vitepress/components/Home.vue | 6 ------ .../i18n/src/locales/vi/tamagotchi/electron/tray.yaml | 2 +- packages/plugin-sdk/src/plugin-host/shared.ts | 1 + packages/plugin-sdk/src/plugin/local.ts | 1 + packages/plugin-sdk/src/plugin/remote.ts | 1 + services/minecraft/eslint.config.js | 10 ---------- .../minecraft/src/cognitive/conscious/history-query.ts | 1 + .../minecraft/src/cognitive/conscious/js-planner.ts | 1 + services/minecraft/src/cognitive/conscious/llmlogic.ts | 1 + .../cognitive/perception/rules/temporal-detector.ts | 6 +++--- services/minecraft/src/debug/tool-executor.ts | 3 +-- services/minecraft/src/debug/web/app.js | 4 +++- services/minecraft/src/skills/inventory.ts | 2 ++ services/telegram-bot/src/prompts/utils.ts | 6 +++--- 14 files changed, 19 insertions(+), 26 deletions(-) delete mode 100644 services/minecraft/eslint.config.js diff --git a/docs/.vitepress/components/Home.vue b/docs/.vitepress/components/Home.vue index fb84d2dea..9b7596a80 100644 --- a/docs/.vitepress/components/Home.vue +++ b/docs/.vitepress/components/Home.vue @@ -5,7 +5,6 @@ import { useLocalStorage, useWindowSize } from '@vueuse/core' import { createAnimatable } from 'animejs' import { useData } from 'vitepress' import { computed, onMounted, shallowRef, useTemplateRef, watch, watchEffect } from 'vue' -import { useI18n } from 'vue-i18n' import homeBackgroundChristmas20251224 from '../assets/home-cover-2025-12-24-bg.avif' // NOTICE: for unknown reasons, without `?no-inline`, the inlined SVG use in the SFC template @@ -27,13 +26,8 @@ import { const heroRef = useTemplateRef('hero') const shouldReduceMotion = useLocalStorage('docs:settings/reduce-motion', false) -const { t } = useI18n() const { width: innerWidth, height: innerHeight } = useWindowSize({ includeScrollbar: true }) -function handleClickTryLive() { - window.location.replace('https://airi.moeru.ai/') -} - const DURATION = 1200 const EASE = 'outSine' diff --git a/packages/i18n/src/locales/vi/tamagotchi/electron/tray.yaml b/packages/i18n/src/locales/vi/tamagotchi/electron/tray.yaml index 76c451d58..29ed05942 100644 --- a/packages/i18n/src/locales/vi/tamagotchi/electron/tray.yaml +++ b/packages/i18n/src/locales/vi/tamagotchi/electron/tray.yaml @@ -21,7 +21,7 @@ menu: close_caption: Close Caption... caption_overlay: Lớp phủ phụ đề follow_window: Theo cửa sổ - reset_position: Đặt lại vị trí + reset_position: Đặt lại vị trí devtools: Công cụ phát triển troubleshoot_beatsync: Sửa lỗi BeatSync... quit: Thoát ra diff --git a/packages/plugin-sdk/src/plugin-host/shared.ts b/packages/plugin-sdk/src/plugin-host/shared.ts index e69de29bb..336ce12bb 100644 --- a/packages/plugin-sdk/src/plugin-host/shared.ts +++ b/packages/plugin-sdk/src/plugin-host/shared.ts @@ -0,0 +1 @@ +export {} diff --git a/packages/plugin-sdk/src/plugin/local.ts b/packages/plugin-sdk/src/plugin/local.ts index e69de29bb..336ce12bb 100644 --- a/packages/plugin-sdk/src/plugin/local.ts +++ b/packages/plugin-sdk/src/plugin/local.ts @@ -0,0 +1 @@ +export {} diff --git a/packages/plugin-sdk/src/plugin/remote.ts b/packages/plugin-sdk/src/plugin/remote.ts index e69de29bb..336ce12bb 100644 --- a/packages/plugin-sdk/src/plugin/remote.ts +++ b/packages/plugin-sdk/src/plugin/remote.ts @@ -0,0 +1 @@ +export {} diff --git a/services/minecraft/eslint.config.js b/services/minecraft/eslint.config.js deleted file mode 100644 index ac2dc7f49..000000000 --- a/services/minecraft/eslint.config.js +++ /dev/null @@ -1,10 +0,0 @@ -export default [ - { - ignores: [ - 'docs/**', - ], - rules: { - perfectionist: 'off', - }, - }, -] diff --git a/services/minecraft/src/cognitive/conscious/history-query.ts b/services/minecraft/src/cognitive/conscious/history-query.ts index cc7c203f6..89b6ee002 100644 --- a/services/minecraft/src/cognitive/conscious/history-query.ts +++ b/services/minecraft/src/cognitive/conscious/history-query.ts @@ -150,6 +150,7 @@ export function createHistoryRuntime(deps: HistoryQueryDeps) { const msg = history[i] if (msg.role !== 'user' || typeof msg.content !== 'string') continue + // eslint-disable-next-line regexp/no-super-linear-backtracking const match = msg.content.match(/\[EVENT\]\s*([^:\n]+:[^\n]+)/) if (match?.[1] && !match[1].startsWith('Perception Signal:')) { chats.unshift(match[1]) diff --git a/services/minecraft/src/cognitive/conscious/js-planner.ts b/services/minecraft/src/cognitive/conscious/js-planner.ts index dae0bff68..b28f11c70 100644 --- a/services/minecraft/src/cognitive/conscious/js-planner.ts +++ b/services/minecraft/src/cognitive/conscious/js-planner.ts @@ -109,6 +109,7 @@ interface DescribeGlobalsOptions { export function extractJavaScriptCandidate(input: string): string { const trimmed = input.trim() + // eslint-disable-next-line regexp/no-super-linear-backtracking const fenced = trimmed.match(/^```(?:js|javascript|ts|typescript)?[^\S\r\n]*\r?\n?([\s\S]*?)\r?\n?```$/i) if (fenced?.[1]) return fenced[1].trim() diff --git a/services/minecraft/src/cognitive/conscious/llmlogic.ts b/services/minecraft/src/cognitive/conscious/llmlogic.ts index 691c220d4..7b4d49a5b 100644 --- a/services/minecraft/src/cognitive/conscious/llmlogic.ts +++ b/services/minecraft/src/cognitive/conscious/llmlogic.ts @@ -153,6 +153,7 @@ export function shouldRetryError(err: unknown, remainingAttempts: number): Retry */ export function extractJsonCandidate(input: string): string { const trimmed = input.trim() + // eslint-disable-next-line regexp/no-super-linear-backtracking const fenced = trimmed.match(/^```(?:json)?[^\S\r\n]*\r?\n?([\s\S]*?)\r?\n?```$/i) if (fenced?.[1]) return fenced[1].trim() diff --git a/services/minecraft/src/cognitive/perception/rules/temporal-detector.ts b/services/minecraft/src/cognitive/perception/rules/temporal-detector.ts index 7979ffe07..1066dfae3 100644 --- a/services/minecraft/src/cognitive/perception/rules/temporal-detector.ts +++ b/services/minecraft/src/cognitive/perception/rules/temporal-detector.ts @@ -27,7 +27,7 @@ export interface ProcessDetectorInput { */ export function createDetectorState(windowSlots: number, nowMs: number = Date.now()): DetectorState { return Object.freeze({ - counts: Object.freeze(new Array(windowSlots).fill(0)), + counts: Object.freeze(Array.from({ length: windowSlots }).fill(0)), head: 0, total: 0, lastUpdateMs: nowMs, @@ -123,7 +123,7 @@ export function resetAfterFire( const windowSize = state.counts.length return Object.freeze({ - counts: Object.freeze(new Array(windowSize).fill(0)), + counts: Object.freeze(Array.from({ length: windowSize }).fill(0)), head: state.head, total: 0, lastUpdateMs: state.lastUpdateMs, @@ -140,7 +140,7 @@ function resetForNewWindow( nowMs: number, ): DetectorState { return Object.freeze({ - counts: Object.freeze(new Array(state.counts.length).fill(0)), + counts: Object.freeze(Array.from({ length: state.counts.length }).fill(0)), head: 0, total: 0, lastUpdateMs: nowMs, diff --git a/services/minecraft/src/debug/tool-executor.ts b/services/minecraft/src/debug/tool-executor.ts index fa408dc06..f74814067 100644 --- a/services/minecraft/src/debug/tool-executor.ts +++ b/services/minecraft/src/debug/tool-executor.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import type { ZodObject, ZodType } from 'zod' import type { Mineflayer } from '../libs/mineflayer' @@ -125,7 +126,6 @@ export class ToolExecutor { // Helper to extract metadata from Zod types private getZodDef(zodType: ZodType): { typeName: 'string' | 'number' | 'boolean', description?: string, min?: number, max?: number, defaultValue?: any } { let typeName: 'string' | 'number' | 'boolean' = 'string' - // eslint-disable-next-line @typescript-eslint/no-explicit-any let curr: any = zodType const description = curr.description @@ -167,7 +167,6 @@ export class ToolExecutor { else if (typeId === 'ZodNumber') { typeName = 'number' // Try to extract min/max from checks - // eslint-disable-next-line @typescript-eslint/no-explicit-any if (curr._def.checks) { for (const check of (curr as any)._def.checks) { if (check.kind === 'min') diff --git a/services/minecraft/src/debug/web/app.js b/services/minecraft/src/debug/web/app.js index b795b06e3..7d5411317 100644 --- a/services/minecraft/src/debug/web/app.js +++ b/services/minecraft/src/debug/web/app.js @@ -187,7 +187,7 @@ class DebugClient { scheduleReconnect() { if (this.reconnectAttempts >= CONFIG.RECONNECT_MAX_ATTEMPTS) { - console.log('Max reconnect attempts reached') + console.warn('Max reconnect attempts reached') return } @@ -823,6 +823,7 @@ class ConversationPanel { // FEEDBACK: "toolName: Success/Failed. details" if (section.tag === 'FEEDBACK') { + // eslint-disable-next-line regexp/no-super-linear-backtracking const fbMatch = text.match(/^(\w+):\s*(Success|Failed)\.?\s*(.*)$/s) if (fbMatch) { const detail = fbMatch[3].slice(0, 50) @@ -1014,6 +1015,7 @@ class ToolsPanel { } requestTools() { + // eslint-disable-next-line no-console console.log('[ToolsPanel] Requesting tools...') // Check if we already have tools to avoid re-rendering on reconnect if not needed // But re-requesting ensures we are in sync with server capabilities diff --git a/services/minecraft/src/skills/inventory.ts b/services/minecraft/src/skills/inventory.ts index 1627da3c7..69fb86671 100644 --- a/services/minecraft/src/skills/inventory.ts +++ b/services/minecraft/src/skills/inventory.ts @@ -183,7 +183,9 @@ async function dropItemsAndWaitForCollection( let settled = false const cleanup = () => { + // eslint-disable-next-line ts/no-use-before-define mineflayer.bot.removeListener('playerCollect', onCollect) + // eslint-disable-next-line ts/no-use-before-define mineflayer.removeListener('interrupt', onInterrupt) } diff --git a/services/telegram-bot/src/prompts/utils.ts b/services/telegram-bot/src/prompts/utils.ts index f5bf9c991..7f7456046 100644 --- a/services/telegram-bot/src/prompts/utils.ts +++ b/services/telegram-bot/src/prompts/utils.ts @@ -5,10 +5,10 @@ export function vif(condition: boolean, a: string, b = '') { } export function vChoice(...args: [boolean | (() => boolean), string][]) { - let exp - for (let i = 0; i < args.length; i++) { - if (typeof (exp = args[i][0]) === 'function' ? exp() : exp) { + const exp = args[i][0] + + if (typeof exp === 'function' ? exp() : exp) { return args[i][1] } }