refactor: 优化eslint配置,提升代码质量 (#1341)

* feat: 统一并标准化eslint

* lint: napcat.webui

* lint: napcat.webui

* lint: napcat.core

* build: fix

* lint: napcat.webui

* refactor: 重构eslint

* Update README.md
This commit is contained in:
时瑾 authored and GitHub committed 2025-11-03 16:30:45 +08:00
1 parent d5b8f886d6
commit 06f6a542f5
651 files changed
+37978 -37584

No files matched your search

@@ -1,39 +1,39 @@
import clsx from 'clsx'
import { ReadyState } from 'react-use-websocket'
import clsx from 'clsx';
import { ReadyState } from 'react-use-websocket';
export interface WSStatusProps {
state: ReadyState
}
function StatusTag({
function StatusTag ({
title,
color
color,
}: {
title: string
color: 'success' | 'primary' | 'warning'
}) {
const textClassName = `text-${color} text-sm`
const bgClassName = `bg-${color}`
const textClassName = `text-${color} text-sm`;
const bgClassName = `bg-${color}`;
return (
<div className="flex flex-col justify-center items-center gap-1 rounded-md px-2 col-span-2 md:col-span-1">
<div className={clsx('w-4 h-4 rounded-full', bgClassName)}></div>
<div className='flex flex-col justify-center items-center gap-1 rounded-md px-2 col-span-2 md:col-span-1'>
<div className={clsx('w-4 h-4 rounded-full', bgClassName)} />
<div className={textClassName}>{title}</div>
</div>
)
);
}
export default function WSStatus({ state }: WSStatusProps) {
export default function WSStatus ({ state }: WSStatusProps) {
if (state === ReadyState.OPEN) {
return <StatusTag title="已连接" color="success" />
return <StatusTag title='已连接' color='success' />;
}
if (state === ReadyState.CLOSED) {
return <StatusTag title="已关闭" color="primary" />
return <StatusTag title='已关闭' color='primary' />;
}
if (state === ReadyState.CONNECTING) {
return <StatusTag title="连接中" color="warning" />
return <StatusTag title='连接中' color='warning' />;
}
if (state === ReadyState.CLOSING) {
return <StatusTag title="关闭中" color="warning" />
return <StatusTag title='关闭中' color='warning' />;
}
return null
return null;
}