chore: integrate husky and lint-staged for pre-commit code formatting (#162)

引入 husky 和 lint-staged,实现在提交代码前格式化修改的代码。

```release-note
None
```
This commit is contained in:
Ryan Wang
2024-08-22 12:54:53 +08:00
committed by GitHub
parent 175c40e230
commit c98869ca5e
3 changed files with 4053 additions and 2587 deletions

1
.husky/pre-commit Normal file
View File

@@ -0,0 +1 @@
npx lint-staged

View File

@@ -8,7 +8,8 @@
"build": "tsc && vite build",
"lint": "eslint ./src --ext .js,.cjs,.mjs,.ts,.cts,.mts --ignore-path .gitignore",
"prettier": "prettier --write \"./src/**/*.{js,ts,css,json,ml,yaml,html}\" \"./templates/**/*.html\"",
"release": "release-it"
"release": "release-it",
"prepare": "husky"
},
"keywords": [
"halo",
@@ -36,6 +37,11 @@
"url": "https://github.com/halo-dev/theme-earth",
"type": "git"
},
"lint-staged": {
"*.{ts,json,yaml,yml,html}": [
"prettier --write"
]
},
"devDependencies": {
"@iconify-json/bx": "^1.1.10",
"@iconify-json/gg": "^1.1.9",
@@ -51,6 +57,8 @@
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^9.1.5",
"lint-staged": "^15.2.9",
"postcss": "^8.4.38",
"prettier": "^3.3.1",
"prettier-plugin-tailwindcss": "^0.6.2",

6629
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff