diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ae16e93..c494b8a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -13,8 +13,6 @@ concurrency:
cancel-in-progress: true
jobs:
- # 💡 1. 提速核心:前置基建节点(Infrastructure Initialization)
- # 专门负责锁死环境、同步下载并缓存 node_modules,下游节点直接满血复用!
setup:
name: Prepare Dependencies
runs-on: ubuntu-latest
@@ -29,7 +27,6 @@ jobs:
with:
node-version: '22'
- # 建立基于 package-lock.json 唯一哈希的缓存大闸
- name: Cache Node Modules
id: cache-nodemodules
uses: actions/cache@v4
@@ -47,7 +44,6 @@ jobs:
id: cache-info
run: echo "key=${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}" >> $GITHUB_OUTPUT
- # 💡 2. 静态语法质检节点(依赖前置节点完成)
lint:
name: Lint
runs-on: ubuntu-latest
@@ -70,7 +66,6 @@ jobs:
- name: Run ESLint
run: npm run lint
- # 💡 3. 强类型守卫节点(2秒瞬时恢复,开箱即查)
typecheck:
name: TypeScript Check
runs-on: ubuntu-latest
@@ -96,7 +91,6 @@ jobs:
- name: Run TypeScript type check
run: npm run typecheck
- # 💡 4. 单元测试节点(无缝运行你刚刚修复完的 setupTests.ts 套件)
test:
name: Unit Tests
runs-on: ubuntu-latest
@@ -122,16 +116,12 @@ jobs:
- name: Run tests
run: npm run test
- # 💡 5. 多端分布式最终编译节点(Production Matrix Compliance)
build:
name: Build (${{ matrix.browser }})
runs-on: ubuntu-latest
- # 只有当 Linter、类型大闸、Vitest 单元测试全数满分通过,才放行最终打包编译
needs: [ lint, typecheck, test ]
strategy:
matrix:
- # 💡 完美对齐 WXT 跨端架构:将 firefox 同步纳入生产编译大矩阵,
- # 如果 firefox 编译因任何多端不兼容挂掉,CI 会立刻拉起警报,防护力拉满!
browser: [ chrome, firefox ]
fail-fast: false
steps:
@@ -149,7 +139,6 @@ jobs:
path: node_modules
key: ${{ runner.os }}-node-v22-${{ hashFiles('**/package-lock.json') }}
- # 💡 动态代理编译指令:完美匹配 WXT / 各类多端打包器的标准构建命令
- name: Generate WXT types
run: npx wxt prepare
diff --git a/eslint.config.ts b/eslint.config.ts
index fd0db65..28b8cab 100644
--- a/eslint.config.ts
+++ b/eslint.config.ts
@@ -5,16 +5,13 @@ import reactPlugin from 'eslint-plugin-react';
import globals from 'globals';
export default tseslint.config(
- // 1. 全局物理隔离:彻底掐灭对构建产物与配置本身的干扰
{
ignores: ['dist', '.output', '.wxt', 'node_modules', 'eslint.config.ts', 'eslint.config.js'],
},
- // 2. 注入 JavaScript 与 TypeScript 的官方大师级推荐规则集
js.configs.recommended,
...tseslint.configs.recommended,
- // 3. 针对测试文件专属沙箱:解耦强类型死锁,放行 any,容忍未消费变量
{
files: ['**/__tests__/**', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}', 'setupTests.ts'],
rules: {
@@ -26,7 +23,6 @@ export default tseslint.config(
},
},
- // 4. 核心业务全受控大管线(Hooks, Entrypoints, Components 统一护航)
{
files: ['src/**/*.{ts,tsx}'],
ignores: ['**/__tests__/**', '**/*.test.{ts,tsx}', '**/*.spec.{ts,tsx}'],
@@ -37,17 +33,13 @@ export default tseslint.config(
...globals.browser,
...globals.node,
},
- // 💡 修复点 1(史诗级治愈):废除脆弱的 project 硬编码路径!
- // 拥抱 typescript-eslint 官方推荐的 projectService 常驻动态类型调度中枢。
- // 它会在内存中全自动、流式为所有新建、悬空或暂存文件分配编译上下文,
- // 彻底终结 "file is not included in any tsconfig" 的全量崩溃黑洞!
+
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
- // 挂载插件沙箱
plugins: {
react: reactPlugin,
'react-hooks': reactHooks,
@@ -59,24 +51,19 @@ export default tseslint.config(
},
},
- // 💡 修复点 2:高精对齐 React 19 / JSX Runtime 的全量生产质检规则大闸
rules: {
- // 激活 react-hooks 官方推荐规则
...reactHooks.configs.recommended.rules,
- // 激活 react 官方精选规则(排除旧版 React 必须手动 import 的历史包袱)
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs['jsx-runtime'].rules,
'react/prop-types': 'off',
- // 清洗原生未消费变量冲突,统一交由 TS 高阶哨兵接管
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
- // 彻底关闭老旧的 JSX 作用域检查,全面契合 React 19 核心美学
'react/react-in-jsx-scope': 'off',
},
},
diff --git a/src/components/RouterContainer.tsx b/src/components/RouterContainer.tsx
index 41bd145..179ebf8 100644
--- a/src/components/RouterContainer.tsx
+++ b/src/components/RouterContainer.tsx
@@ -4,35 +4,32 @@ import { Suspense, useMemo } from 'react';
import { useI18n } from '@/utils/chromeI18n';
import PageErrorBoundary from '@/components/PageErrorBoundary';
import PageSkeleton from '@/components/PageSkeleton';
-import { cn } from '@/lib/utils'; // 1. 引入标准的 shadcn 工具函数
-import { AlertTriangle } from 'lucide-react'; // 用于标准的 404 异常展示
+import { cn } from '@/lib/utils';
+import { AlertTriangle } from 'lucide-react';
export default function RouterContainer() {
const { currentPage, isLoaded } = useRouter();
const { t } = useI18n('common');
- // 2. 稳定的动态动画类名映射
const animationClass = useMemo(() => {
return currentPage === 'dashboard' ? 'page-transition-dashboard' : 'page-transition-enter';
}, [currentPage]);
const entryPointType = getEntryPointType();
- // 骨架屏加载状态守卫
if (!isLoaded) {
return
{error ? t('jsonFormat:fixErrorHint') : t(`jsonFormat:${pk}EmptyHint`)}
diff --git a/src/pages/JsonTools/index.tsx b/src/pages/JsonTools/index.tsx
index e30e4d5..3b7fb2b 100644
--- a/src/pages/JsonTools/index.tsx
+++ b/src/pages/JsonTools/index.tsx
@@ -146,7 +146,7 @@ export default function Index() {
value={leftInput}
onChange={(val) => {
setLeftInput(val);
- setCurrentDiffIndex(0); // 💡 在同一个用户键盘事件中打包批处理,0 副作用开销
+ setCurrentDiffIndex(0);
}}
error={leftError}
minRows={9}
@@ -157,7 +157,7 @@ export default function Index() {
value={rightInput}
onChange={(val) => {
setRightInput(val);
- setCurrentDiffIndex(0); // 💡 在同一个用户键盘事件中打包批处理,0 副作用开销
+ setCurrentDiffIndex(0);
}}
error={rightError}
minRows={9}
diff --git a/src/pages/QrCode/__tests__/index.test.tsx b/src/pages/QrCode/__tests__/index.test.tsx
index f4800d5..5c04ded 100644
--- a/src/pages/QrCode/__tests__/index.test.tsx
+++ b/src/pages/QrCode/__tests__/index.test.tsx
@@ -6,19 +6,16 @@ vi.mock('lucide-react', async (importOriginal) => {
const actual = await importOriginal