chore: 添加 husky 并配置 pre-commit 钩子

- 添加 husky 依赖用于 Git 钩子管理
- 配置 pre-commit 钩子自动执行 eslint 检查
- 在 package.json 中添加 prepare 脚本自动安装 husky
This commit is contained in:
feige996 2025-06-03 18:44:23 +08:00
parent 604dab5f38
commit c5a1b1cd9c
3 changed files with 15 additions and 1 deletions

2
.husky/pre-commit Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

View File

@ -69,7 +69,8 @@
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei", "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union", "build:quickapp-webview-union": "uni build -p quickapp-webview-union",
"type-check": "vue-tsc --noEmit", "type-check": "vue-tsc --noEmit",
"openapi-ts-request": "openapi-ts" "openapi-ts-request": "openapi-ts",
"prepare": "husky"
}, },
"lint-staged": { "lint-staged": {
"**/*.{html,vue,ts,cjs,json,md}": [ "**/*.{html,vue,ts,cjs,json,md}": [
@ -134,6 +135,7 @@
"@vue/runtime-core": "^3.4.21", "@vue/runtime-core": "^3.4.21",
"@vue/tsconfig": "^0.1.3", "@vue/tsconfig": "^0.1.3",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"husky": "^9.1.7",
"lint-staged": "^15.2.10", "lint-staged": "^15.2.10",
"openapi-ts-request": "^1.1.2", "openapi-ts-request": "^1.1.2",
"oxlint": "^0.1.0", "oxlint": "^0.1.0",

10
pnpm-lock.yaml generated
View File

@ -159,6 +159,9 @@ importers:
autoprefixer: autoprefixer:
specifier: ^10.4.20 specifier: ^10.4.20
version: 10.4.20(postcss@8.4.49) version: 10.4.20(postcss@8.4.49)
husky:
specifier: ^9.1.7
version: 9.1.7
lint-staged: lint-staged:
specifier: ^15.2.10 specifier: ^15.2.10
version: 15.2.10 version: 15.2.10
@ -3391,6 +3394,11 @@ packages:
resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==}
engines: {node: '>=16.17.0'} engines: {node: '>=16.17.0'}
husky@9.1.7:
resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==}
engines: {node: '>=18'}
hasBin: true
iconv-lite@0.4.24: iconv-lite@0.4.24:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -9630,6 +9638,8 @@ snapshots:
human-signals@5.0.0: {} human-signals@5.0.0: {}
husky@9.1.7: {}
iconv-lite@0.4.24: iconv-lite@0.4.24:
dependencies: dependencies:
safer-buffer: 2.1.2 safer-buffer: 2.1.2