feat: migrate ESLint to v9 flat config

- Replace .eslintrc.json with eslint.config.mjs
- Simplify configuration using @antfu/eslint-config
- Add necessary ESLint plugin dependencies
- Disable overly strict style rules
- Set package.json type to module for ESM support
- Fix ESLint disable comment format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
lyzno1
2025-09-10 22:21:17 +08:00
parent 2b1882a5e3
commit 05dcfcf0ca
85 changed files with 464 additions and 502 deletions

View File

@ -2,7 +2,7 @@ import type { Annotation } from './log'
import type { Locale } from '@/i18n'
import type { ThoughtItem } from '@/app/components/chat/type'
export type PromptVariable = {
export interface PromptVariable {
key: string
name: string
type: string
@ -15,19 +15,19 @@ export type PromptVariable = {
allowed_file_upload_methods?: TransferMethod[]
}
export type PromptConfig = {
export interface PromptConfig {
prompt_template: string
prompt_variables: PromptVariable[]
}
export type TextTypeFormItem = {
export interface TextTypeFormItem {
label: string
variable: string
required: boolean
max_length: number
}
export type SelectTypeFormItem = {
export interface SelectTypeFormItem {
label: string
variable: string
required: boolean
@ -39,26 +39,26 @@ export type SelectTypeFormItem = {
export type UserInputFormItem = {
'text-input': TextTypeFormItem
} | {
'select': SelectTypeFormItem
select: SelectTypeFormItem
} | {
'paragraph': TextTypeFormItem
paragraph: TextTypeFormItem
}
export const MessageRatings = ['like', 'dislike', null] as const
export type MessageRating = typeof MessageRatings[number]
export type Feedbacktype = {
export interface Feedbacktype {
rating: MessageRating
content?: string | null
}
export type MessageMore = {
export interface MessageMore {
time: string
tokens: number
latency: number | string
}
export type IChatItem = {
export interface IChatItem {
id: string
content: string
/**
@ -85,7 +85,7 @@ export type IChatItem = {
useCurrentUserAvatar?: boolean
isOpeningStatement?: boolean
suggestedQuestions?: string[]
log?: { role: string; text: string }[]
log?: { role: string, text: string }[]
agent_thoughts?: ThoughtItem[]
message_files?: VisionFile[]
}
@ -96,17 +96,17 @@ export type ChatItem = IChatItem & {
workflowProcess?: WorkflowProcess
}
export type ResponseHolder = {}
export interface ResponseHolder {}
export type ConversationItem = {
export interface ConversationItem {
id: string
name: string
inputs: Record<string, any> | null
introduction: string,
introduction: string
suggested_questions?: string[]
}
export type AppInfo = {
export interface AppInfo {
title: string
description: string
default_language: Locale
@ -125,7 +125,7 @@ export enum TransferMethod {
remote_url = 'remote_url',
}
export type VisionSettings = {
export interface VisionSettings {
enabled: boolean
number_limits: number
detail: Resolution
@ -133,7 +133,7 @@ export type VisionSettings = {
image_file_size_limit?: number | string
}
export type ImageFile = {
export interface ImageFile {
type: TransferMethod
_id: string
fileId: string
@ -144,7 +144,7 @@ export type ImageFile = {
deleted?: boolean
}
export type VisionFile = {
export interface VisionFile {
id?: string
type: string
transfer_method: TransferMethod
@ -168,7 +168,7 @@ export enum BlockEnum {
Tool = 'tool',
}
export type NodeTracing = {
export interface NodeTracing {
id: string
index: number
predecessor_node_id: string
@ -213,7 +213,7 @@ export enum WorkflowRunningStatus {
Stopped = 'stopped',
}
export type WorkflowProcess = {
export interface WorkflowProcess {
status: WorkflowRunningStatus
tracing: NodeTracing[]
expand?: boolean // for UI

View File

@ -1,5 +1,5 @@
export type TypeWithI18N<T = string> = {
'en_US': T
'zh_Hans': T
export interface TypeWithI18N<T = string> {
en_US: T
zh_Hans: T
[key: string]: T
}

View File

@ -1,4 +1,4 @@
export type LogAnnotation = {
export interface LogAnnotation {
content: string
account: {
id: string
@ -8,7 +8,7 @@ export type LogAnnotation = {
created_at: number
}
export type Annotation = {
export interface Annotation {
id: string
authorName: string
logAnnotation?: LogAnnotation

View File

@ -9,10 +9,10 @@ export enum AuthType {
apiKey = 'api_key',
}
export type Credential = {
'auth_type': AuthType
'api_key_header'?: string
'api_key_value'?: string
export interface Credential {
auth_type: AuthType
api_key_header?: string
api_key_value?: string
}
export enum CollectionType {
@ -21,12 +21,12 @@ export enum CollectionType {
custom = 'api',
}
export type Emoji = {
export interface Emoji {
background: string
content: string
}
export type Collection = {
export interface Collection {
id: string
name: string
author: string
@ -39,7 +39,7 @@ export type Collection = {
allow_delete: boolean
}
export type ToolParameter = {
export interface ToolParameter {
name: string
label: TypeWithI18N
human_description: TypeWithI18N
@ -52,14 +52,14 @@ export type ToolParameter = {
}[]
}
export type Tool = {
export interface Tool {
name: string
label: TypeWithI18N
description: any
parameters: ToolParameter[]
}
export type ToolCredential = {
export interface ToolCredential {
name: string
label: TypeWithI18N
help: TypeWithI18N
@ -73,7 +73,7 @@ export type ToolCredential = {
}[]
}
export type CustomCollectionBackend = {
export interface CustomCollectionBackend {
provider: string
original_provider?: string
credentials: Credential
@ -84,7 +84,7 @@ export type CustomCollectionBackend = {
tools?: ParamItem[]
}
export type ParamItem = {
export interface ParamItem {
name: string
label: TypeWithI18N
human_description: TypeWithI18N
@ -99,7 +99,7 @@ export type ParamItem = {
}[]
}
export type CustomParamSchema = {
export interface CustomParamSchema {
operation_id: string // name
summary: string
server_url: string