Files
testing-tool/tsconfig.json
T

55 lines
1.8 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"
],
"exclude": ["node_modules", ".wxt", "eslint.config.ts"]
}