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

@ -16,11 +16,11 @@ import {
} from '@/app/components/base/icons/workflow'
import AppIcon from '@/app/components/base/app-icon'
type BlockIconProps = {
interface BlockIconProps {
type: BlockEnum
size?: string
className?: string
toolIcon?: string | { content: string; background: string }
toolIcon?: string | { content: string, background: string }
}
const ICON_CONTAINER_CLASSNAME_SIZE_MAP: Record<string, string> = {
xs: 'w-4 h-4 rounded-[5px] shadow-xs',

View File

@ -9,7 +9,7 @@ import './style.css'
// load file from local instead of cdn https://github.com/suren-atoyan/monaco-react/issues/482
loader.config({ paths: { vs: '/vs' } })
type Props = {
interface Props {
value?: string | object
onChange?: (value: string) => void
title: JSX.Element
@ -72,8 +72,7 @@ const CodeEditor: FC<Props> = ({
}
const outPutValue = (() => {
if (!isJSONStringifyBeauty)
return value as string
if (!isJSONStringifyBeauty) { return value as string }
try {
return JSON.stringify(value as object, null, 2)
}

View File

@ -8,7 +8,7 @@ import ToggleExpandBtn from './toggle-expand-btn'
import useToggleExpend from './use-toggle-expend'
import { Clipboard, ClipboardCheck } from '@/app/components/base/icons/line/files'
type Props = {
interface Props {
className?: string
title: JSX.Element | string
headerRight?: JSX.Element

View File

@ -4,7 +4,7 @@ import type { FC } from 'react'
import { useDebounceFn } from 'ahooks'
import cn from 'classnames'
type Props = {
interface Props {
className?: string
height: number
minHeight: number
@ -40,14 +40,12 @@ const PromptEditorHeightResizeWrap: FC<Props> = ({
}, [prevUserSelectStyle])
const { run: didHandleResize } = useDebounceFn((e) => {
if (!isResizing)
return
if (!isResizing) { return }
const offset = e.clientY - clientY
let newHeight = height + offset
setClientY(e.clientY)
if (newHeight < minHeight)
newHeight = minHeight
if (newHeight < minHeight) { newHeight = minHeight }
onHeightChange(newHeight)
}, {
wait: 0,
@ -85,7 +83,8 @@ const PromptEditorHeightResizeWrap: FC<Props> = ({
{!hideResize && (
<div
className='absolute bottom-0 left-0 w-full flex justify-center h-2 cursor-row-resize'
onMouseDown={handleStartResize}>
onMouseDown={handleStartResize}
>
<div className='w-5 h-[3px] rounded-sm bg-gray-300'></div>
</div>
)}

View File

@ -4,7 +4,7 @@ import React, { useCallback } from 'react'
import Expand04 from '@/app/components/base/icons/solid/expand-04'
import Collapse04 from '@/app/components/base/icons/line/arrows/collapse-04'
type Props = {
interface Props {
isExpand: boolean
onExpandChange: (isExpand: boolean) => void
}

View File

@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'
type Params = {
interface Params {
ref: React.RefObject<HTMLDivElement>
hasFooter?: boolean
}

View File

@ -9,7 +9,7 @@ import Loading02 from '@/app/components/base/icons/line/loading-02'
import CheckCircle from '@/app/components/base/icons/line/check-circle'
import type { NodeTracing } from '@/types/app'
type Props = {
interface Props {
nodeInfo: NodeTracing
hideInfo?: boolean
}
@ -18,20 +18,15 @@ const NodePanel: FC<Props> = ({ nodeInfo, hideInfo = false }) => {
const [collapseState, setCollapseState] = useState<boolean>(true)
const getTime = (time: number) => {
if (time < 1)
return `${(time * 1000).toFixed(3)} ms`
if (time > 60)
return `${parseInt(Math.round(time / 60).toString())} m ${(time % 60).toFixed(3)} s`
if (time < 1) { return `${(time * 1000).toFixed(3)} ms` }
if (time > 60) { return `${parseInt(Math.round(time / 60).toString())} m ${(time % 60).toFixed(3)} s` }
return `${time.toFixed(3)} s`
}
const getTokenCount = (tokens: number) => {
if (tokens < 1000)
return tokens
if (tokens >= 1000 && tokens < 1000000)
return `${parseFloat((tokens / 1000).toFixed(3))}K`
if (tokens >= 1000000)
return `${parseFloat((tokens / 1000000).toFixed(3))}M`
if (tokens < 1000) { return tokens }
if (tokens >= 1000 && tokens < 1000000) { return `${parseFloat((tokens / 1000).toFixed(3))}K` }
if (tokens >= 1000000) { return `${parseFloat((tokens / 1000000).toFixed(3))}M` }
}
useEffect(() => {

View File

@ -12,7 +12,7 @@ import Loading02 from '@/app/components/base/icons/line/loading-02'
import ChevronRight from '@/app/components/base/icons/line/chevron-right'
import { WorkflowRunningStatus } from '@/types/app'
type WorkflowProcessProps = {
interface WorkflowProcessProps {
data: WorkflowProcess
grayBg?: boolean
expand?: boolean
@ -30,14 +30,11 @@ const WorkflowProcessItem = ({
const failed = data.status === WorkflowRunningStatus.Failed || data.status === WorkflowRunningStatus.Stopped
const background = useMemo(() => {
if (running && !collapse)
return 'linear-gradient(180deg, #E1E4EA 0%, #EAECF0 100%)'
if (running && !collapse) { return 'linear-gradient(180deg, #E1E4EA 0%, #EAECF0 100%)' }
if (succeeded && !collapse)
return 'linear-gradient(180deg, #ECFDF3 0%, #F6FEF9 100%)'
if (succeeded && !collapse) { return 'linear-gradient(180deg, #ECFDF3 0%, #F6FEF9 100%)' }
if (failed && !collapse)
return 'linear-gradient(180deg, #FEE4E2 0%, #FEF3F2 100%)'
if (failed && !collapse) { return 'linear-gradient(180deg, #FEE4E2 0%, #FEF3F2 100%)' }
}, [running, succeeded, failed, collapse])
useEffect(() => {