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

+94 -94
View File
@@ -1,18 +1,18 @@
import { z } from 'zod'
import { z } from 'zod';
import { baseResponseSchema, commonResponseDataSchema } from './response'
import { baseResponseSchema, commonResponseDataSchema } from './response';
const oneBotHttpApiSystem = {
'/get_online_clients': {
description: '获取当前账号在线客户端列表',
request: z.object({
no_cache: z.boolean().optional().describe('是否不使用缓存')
no_cache: z.boolean().optional().describe('是否不使用缓存'),
}),
response: baseResponseSchema.extend({
data: z.object({
clients: z.object({})
})
})
clients: z.object({}),
}),
}),
},
'/get_robot_uin_range': {
description: '获取机器人账号范围',
@@ -21,15 +21,15 @@ const oneBotHttpApiSystem = {
data: z.array(
z.object({
minUin: z.string(),
maxUin: z.string()
maxUin: z.string(),
})
)
})
),
}),
},
'/ocr_image': {
description: 'OCR图片识别',
request: z.object({
image: z.string()
image: z.string(),
}),
response: baseResponseSchema.extend({
data: z.array(
@@ -37,19 +37,19 @@ const oneBotHttpApiSystem = {
text: z.string(),
pt1: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt2: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt3: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt4: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
charBox: z.array(
z.object({
@@ -57,33 +57,33 @@ const oneBotHttpApiSystem = {
charBox: z.object({
pt1: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt2: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt3: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt4: z.object({
x: z.string(),
y: z.string()
})
})
y: z.string(),
}),
}),
})
),
score: z.string()
score: z.string(),
})
)
})
),
}),
},
'/.ocr_image': {
description: '.OCR图片识别',
request: z.object({
image: z.string()
image: z.string(),
}),
response: baseResponseSchema.extend({
data: z.array(
@@ -91,19 +91,19 @@ const oneBotHttpApiSystem = {
text: z.string(),
pt1: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt2: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt3: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt4: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
charBox: z.array(
z.object({
@@ -111,36 +111,36 @@ const oneBotHttpApiSystem = {
charBox: z.object({
pt1: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt2: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt3: z.object({
x: z.string(),
y: z.string()
y: z.string(),
}),
pt4: z.object({
x: z.string(),
y: z.string()
})
})
y: z.string(),
}),
}),
})
),
score: z.string()
score: z.string(),
})
)
})
),
}),
},
'/translate_en2zh': {
description: '英文翻译为中文',
request: z.object({
words: z.array(z.string())
words: z.array(z.string()),
}),
response: baseResponseSchema.extend({
data: z.array(z.string())
})
data: z.array(z.string()),
}),
},
'/get_login_info': {
description: '获取登录号信息',
@@ -148,19 +148,19 @@ const oneBotHttpApiSystem = {
response: baseResponseSchema.extend({
data: z.object({
user_id: z.number(),
nickname: z.string()
})
})
nickname: z.string(),
}),
}),
},
'/set_input_status': {
description: '设置输入状态',
request: z.object({
eventType: z.union([z.literal(0), z.literal(1)]),
user_id: z.union([z.number(), z.string()])
user_id: z.union([z.number(), z.string()]),
}),
response: baseResponseSchema.extend({
data: commonResponseDataSchema
})
data: commonResponseDataSchema,
}),
},
'/download_file': {
description: '下载文件到缓存目录',
@@ -170,112 +170,112 @@ const oneBotHttpApiSystem = {
url: z.string().optional(),
thread_count: z.number(),
headers: z.union([z.string(), z.array(z.string())]),
name: z.string().optional()
name: z.string().optional(),
})
.refine(
(data) => (data.base64 && !data.url) || (!data.base64 && data.url),
{
message: 'base64 和 url 必须二选一,且不能同时存在或同时为空',
path: ['base64', 'url']
path: ['base64', 'url'],
}
),
response: baseResponseSchema.extend({
data: z.object({
file: z.string()
})
})
file: z.string(),
}),
}),
},
'/get_cookies': {
description: '获取cookies',
request: z.object({
domain: z.string()
domain: z.string(),
}),
response: baseResponseSchema.extend({
data: z.object({
cookies: z.string(),
bkn: z.string()
})
})
bkn: z.string(),
}),
}),
},
'/.handle_quick_operation': {
description: '.对事件执行快速操作',
request: z.object({
context: z.object({}),
operation: z.object({})
operation: z.object({}),
}),
response: baseResponseSchema
response: baseResponseSchema,
},
'/get_csrf_token': {
description: '获取CSRF Token',
request: z.object({}),
response: baseResponseSchema.extend({
data: z.object({
token: z.number()
})
})
token: z.number(),
}),
}),
},
'/_del_group_notice': {
description: '_删除群公告',
request: z.object({
group_id: z.union([z.number(), z.string()]),
notice_id: z.number()
notice_id: z.number(),
}),
response: baseResponseSchema
response: baseResponseSchema,
},
'/get_credentials': {
description: '获取 QQ 相关接口凭证',
request: z.object({
domain: z.string()
domain: z.string(),
}),
response: baseResponseSchema.extend({
data: z.object({
cookies: z.string(),
token: z.number()
})
})
token: z.number(),
}),
}),
},
'/_get_model_show': {
description: '_获取在线机型',
request: z.object({
model: z.string()
model: z.string(),
}),
response: baseResponseSchema.extend({
data: z.array(
z.object({
variants: z.object({
model_show: z.string(),
need_pay: z.boolean()
})
need_pay: z.boolean(),
}),
})
)
})
),
}),
},
'/_set_model_show': {
description: '_设置在线机型',
request: z.object({
model: z.string(),
model_show: z.string()
model_show: z.string(),
}),
response: baseResponseSchema
response: baseResponseSchema,
},
'/can_send_image': {
description: '检查是否可以发送图片',
request: z.object({}),
response: baseResponseSchema.extend({
yes: z.boolean()
})
yes: z.boolean(),
}),
},
'/nc_get_packet_status': {
description: '获取packet状态',
request: z.object({}),
response: baseResponseSchema
response: baseResponseSchema,
},
'/can_send_record': {
description: '检查是否可以发送语音',
request: z.object({}),
response: baseResponseSchema.extend({
yes: z.boolean()
})
yes: z.boolean(),
}),
},
'/get_status': {
description: '获取状态',
@@ -284,9 +284,9 @@ const oneBotHttpApiSystem = {
data: z.object({
online: z.boolean(),
good: z.boolean(),
stat: z.object({})
})
})
stat: z.object({}),
}),
}),
},
'/nc_get_rkey': {
description: '获取rkey',
@@ -297,10 +297,10 @@ const oneBotHttpApiSystem = {
rkey: z.string(),
ttl: z.string(),
time: z.number(),
type: z.number()
type: z.number(),
})
)
})
),
}),
},
'/get_version_info': {
description: '获取版本信息',
@@ -309,14 +309,14 @@ const oneBotHttpApiSystem = {
data: z.object({
app_name: z.string(),
protocol_version: z.string(),
app_version: z.string()
})
})
app_version: z.string(),
}),
}),
},
'/get_group_shut_list': {
description: '获取群禁言列表',
request: z.object({
group_id: z.union([z.number(), z.string()])
group_id: z.union([z.number(), z.string()]),
}),
response: baseResponseSchema.extend({
data: z.object({
@@ -357,10 +357,10 @@ const oneBotHttpApiSystem = {
memberMobileFlag: z.number(),
memberFlagExt2: z.number(),
isSpecialShielded: z.boolean(),
cardNameId: z.number()
})
})
}
} as const
cardNameId: z.number(),
}),
}),
},
} as const;
export default oneBotHttpApiSystem
export default oneBotHttpApiSystem;