chore: 提交时自动格式化代码
- 安装 husky (^9.1.7) 和 lint-staged (^16.2.7) - 配置 pre-commit hook 自动运行 Prettier - 创建 .prettierignore 排除不需要格式化的文件
This commit is contained in:
12
package.json
12
package.json
@@ -18,7 +18,8 @@
|
||||
"format": "prettier --write \"src/**/*.js\" \"scripts/**/*.js\" \"test/**/*.js\" \".github/**/*.yml\" \"*.{md,json}\" \"config/**/*.md\" \"config/**/*.yml\"",
|
||||
"format:check": "prettier --check \"src/**/*.js\" \"scripts/**/*.js\" \"test/**/*.js\" \".github/**/*.yml\" \"*.{md,json}\" \"config/**/*.md\" \"config/**/*.yml\"",
|
||||
"format:check:changed": "node ./scripts/format-check-changed.js",
|
||||
"check": "npm run lint && npm test && npm run build"
|
||||
"check": "npm run lint && npm test && npm run build",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"keywords": [
|
||||
"navigation",
|
||||
@@ -28,16 +29,23 @@
|
||||
"author": "Your Name",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.1.1",
|
||||
"handlebars": "^4.7.8",
|
||||
"js-yaml": "^4.1.1",
|
||||
"rss-parser": "^3.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.27.2",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^16.2.7",
|
||||
"prettier": "^3.4.2",
|
||||
"serve": "^14.2.5"
|
||||
},
|
||||
"overrides": {
|
||||
"brace-expansion": "1.1.12"
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.js": "node ./node_modules/prettier/bin/prettier.cjs --write --ignore-unknown",
|
||||
"**/*.{yml,yaml,md,css}": "node ./node_modules/prettier/bin/prettier.cjs --write --ignore-unknown",
|
||||
"**/!(package-lock).json": "node ./node_modules/prettier/bin/prettier.cjs --write --ignore-unknown"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user