9ff6b8985c
- 创建 CLAUDE.md 项目开发指导文档 - 提取公共常量到 components/constants.ts - 修复 TimestampToDatetime 重复插件扩展问题 - 修复 DatetimeToTimestamp 时区解析问题 - 优化 RoutePersistence 移除不必要依赖 - 添加 Vitest 测试框架配置 - 为所有组件编写单元测试 (16个测试用例) - 更新 .gitignore 忽略测试结果目录 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
1.9 KiB
JSON
65 lines
1.9 KiB
JSON
{
|
|
"extends": "./.wxt/tsconfig.json",
|
|
"compilerOptions": {
|
|
/* --- 原有配置保持 --- */
|
|
"allowImportingTsExtensions": true,
|
|
"jsx": "react-jsx",
|
|
"esModuleInterop": true,
|
|
"module": "ESNext", // 支持 import.meta
|
|
"moduleResolution": "Bundler", // 或者用 "Node"
|
|
|
|
/* --- 1. 严格类型检查 (关键) --- */
|
|
// 开启所有严格检查,包括 noImplicitAny。
|
|
// 这能帮你捕获 "timer" 隐式 any 等错误,强制你写出更高质量的代码。
|
|
"strict": true,
|
|
|
|
/* --- 2. 代码质量检查 --- */
|
|
// 声明了但没使用的变量报错(防止代码冗余)
|
|
"noUnusedLocals": true,
|
|
// 函数参数没使用报错
|
|
"noUnusedParameters": true,
|
|
// 函数必须有返回值,防止遗漏 return
|
|
"noImplicitReturns": true,
|
|
// switch 语句没有 break 时报错
|
|
"noFallthroughCasesInSwitch": true,
|
|
|
|
/* --- 3. 路径与环境 --- */
|
|
// 设置基础目录,方便解析相对路径
|
|
"baseUrl": ".",
|
|
// 确保包含 DOM 类型(解决 setTimeout、document 等报错)
|
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
// 编译目标设置为最新,WXT 底层 Vite 会处理降级兼容
|
|
"target": "ESNext",
|
|
|
|
/* --- 4. 路径别名 (可选) --- */
|
|
// 如果你的 @/utils/... 爆红,可以手动添加这个映射。
|
|
// WXT 通常会自动处理,但在这里显式声明有助于 VS Code 智能提示。
|
|
"paths": {
|
|
"@/*": ["./*"]
|
|
},
|
|
"types": ["chrome", "webextension-polyfill"],
|
|
"noImplicitAny": false
|
|
},
|
|
// 确保包含你的源代码目录
|
|
"include": [
|
|
"entrypoints/**/*",
|
|
"components/**/*",
|
|
"utils/**/*",
|
|
"assets/**/*",
|
|
"hooks/**/*",
|
|
".wxt/types/**/*.ts",
|
|
".wxt/types/*.d.ts",
|
|
"components",
|
|
"eslint.config.ts"
|
|
],
|
|
"exclude": [
|
|
"node_modules",
|
|
".wxt",
|
|
"components/__tests__",
|
|
"**/*.test.tsx",
|
|
"**/*.test.ts",
|
|
"vitest.config.ts",
|
|
"vitest.setup.ts"
|
|
]
|
|
}
|