style: lint

This commit is contained in:
Neko Ayaka
2026-03-19 14:27:23 +08:00
parent 60cbea1e19
commit 956a4541e9
14 changed files with 19 additions and 26 deletions
-6
View File
@@ -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<HTMLDivElement>('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'
@@ -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
@@ -0,0 +1 @@
export {}
+1
View File
@@ -0,0 +1 @@
export {}
+1
View File
@@ -0,0 +1 @@
export {}
-10
View File
@@ -1,10 +0,0 @@
export default [
{
ignores: [
'docs/**',
],
rules: {
perfectionist: 'off',
},
},
]
@@ -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])
@@ -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()
@@ -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()
@@ -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<number>(windowSlots).fill(0)),
counts: Object.freeze(Array.from<number>({ 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<number>(windowSize).fill(0)),
counts: Object.freeze(Array.from<number>({ 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<number>(state.counts.length).fill(0)),
counts: Object.freeze(Array.from<number>({ length: state.counts.length }).fill(0)),
head: 0,
total: 0,
lastUpdateMs: nowMs,
@@ -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<any>): { 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')
+3 -1
View File
@@ -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
@@ -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)
}
+3 -3
View File
@@ -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]
}
}