1
0

feat: 前端 ESLint 规则增强,自动检测 LLM 编码违规

- 启用 TanStack Query flat/recommended(7 条规则)
- 新增 no-console(允许 warn/error)、consistent-type-imports(inline 风格)、no-non-null-assertion 规则
- 新增自定义规则 no-hardcoded-color-in-style,检测 JSX style 中硬编码颜色值
- 将 ESLint 检查集成到 build 命令(tsc -b && eslint . && vite build)
- 修复现有代码中的 lint 违规(import 顺序、type import 风格、unused vars)
- 使用 @typescript-eslint/rule-tester 编写自定义规则集成测试
This commit is contained in:
2026-04-23 22:47:32 +08:00
parent 1d7e839b49
commit 52007c9461
32 changed files with 531 additions and 55 deletions

View File

@@ -1,7 +1,7 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { MessagePlugin } from 'tdesign-react';
import type { CreateModelInput, UpdateModelInput, ApiError } from '@/types';
import * as api from '@/api/models';
import type { CreateModelInput, UpdateModelInput, ApiError } from '@/types';
const ERROR_MESSAGES: Record<string, string> = {
duplicate_model: '同一供应商下模型名称已存在',

View File

@@ -1,7 +1,7 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { MessagePlugin } from 'tdesign-react';
import type { CreateProviderInput, UpdateProviderInput, ApiError } from '@/types';
import * as api from '@/api/providers';
import type { CreateProviderInput, UpdateProviderInput, ApiError } from '@/types';
const ERROR_MESSAGES: Record<string, string> = {
duplicate_model: '同一供应商下模型名称已存在',

View File

@@ -1,6 +1,6 @@
import { useQuery } from '@tanstack/react-query';
import type { StatsQueryParams } from '@/types';
import * as api from '@/api/stats';
import type { StatsQueryParams } from '@/types';
export const statsKeys = {
filtered: (params?: StatsQueryParams) => ['stats', params] as const,