Skip to content

Commit c347174

Browse files
committed
build(deps): automatically format code before submit
1 parent 5d379df commit c347174

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Thumbs.db
33
node_modules
44
package-lock.json
55
yarn.lock
6+
pnpm-lock.yaml
67
.github/*
78
.vscode/*
89
.idea/*
10+
.husky/*

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"scripts": {
77
"format": "prettier --write ./source/js/*.js ./scripts",
88
"lint:style": "stylelint --fix ./source/css",
9-
"git:push": "git push --tag && git push -u origin dev",
10-
"git:add": "npm run format && npm run lint:style && git add ."
9+
"prepare": "husky install"
1110
},
1211
"repository": {
1312
"type": "git",
@@ -28,10 +27,16 @@
2827
"url": "https://github.com/XPoet/hexo-theme-keep/issues"
2928
},
3029
"homepage": "https://github.com/XPoet/hexo-theme-keep#readme",
30+
"lint-staged": {
31+
"*.{styl}": "stylelint --fix",
32+
"*.{js}": "prettier --write"
33+
},
3134
"devDependencies": {
35+
"lint-staged": "^13.2.3",
3236
"prettier": "^2.7.1",
3337
"stylelint": "^14.13.0",
3438
"stylelint-config-rational-order": "^0.1.2",
35-
"stylelint-stylus": "^0.17.0"
39+
"stylelint-stylus": "^0.17.0",
40+
"husky": "^8.0.0"
3641
}
3742
}

0 commit comments

Comments
 (0)