feat: 添加 husky 和 lint-staged 支持,配置 prettier 进行代码格式化

This commit is contained in:
雨霖铃
2026-01-28 20:26:48 +08:00
parent 4edb2f1a47
commit 710bffd2f8
10 changed files with 338 additions and 112 deletions
+39 -2
View File
@@ -1,7 +1,44 @@
{
"extends": "./.wxt/tsconfig.json",
"compilerOptions": {
/* --- --- */
"allowImportingTsExtensions": true,
"jsx": "react-jsx"
}
"jsx": "react-jsx",
/* --- 1. () --- */
// 开启所有严格检查,包括 noImplicitAny。
// 这能帮你捕获 "timer" 隐式 any 等错误,强制你写出更高质量的代码。
"strict": true,
/* --- 2. --- */
// 声明了但没使用的变量报错(防止代码冗余)
"noUnusedLocals": true,
// 函数参数没使用报错
"noUnusedParameters": 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": {
"@/*": ["./entrypoints/*", "./components/*", "./utils/*", "./assets/*"]
}
},
// 确保包含你的源代码目录
"include": [
"entrypoints/**/*",
"components/**/*",
"utils/**/*",
"assets/**/*",
".wxt/types/**/*.ts"
]
}