Add format script to pre-commit hook (#2146)

* Add format script to pre-commit hook

* build: add husky prepare step

* build: add lint-staged

* build: add lint-staged

Co-authored-by: rickstaa <rick.staa@outlook.com>
This commit is contained in:
Taehyun Hwang 2022-10-07 19:33:54 +09:00 committed by GitHub
parent bcb8ae9281
commit e8dfbde7bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 889 additions and 390 deletions

1
.husky/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
_

5
.husky/pre-commit Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm test
npx lint-staged

1259
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -13,8 +13,9 @@
"preview-theme": "node scripts/preview-theme",
"close-stale-theme-prs": "node scripts/close-stale-theme-prs",
"generate-langs-json": "node scripts/generate-langs-json",
"format": "./node_modules/.bin/prettier --write .",
"format:check": "./node_modules/.bin/prettier --check ."
"format": "prettier --write .",
"format:check": "prettier --check .",
"prepare": "husky install"
},
"author": "Anurag Hazra",
"license": "MIT",
@ -27,10 +28,11 @@
"axios-mock-adapter": "^1.18.1",
"color-contrast-checker": "^2.1.0",
"hjson": "^3.2.2",
"husky": "^4.2.5",
"husky": "^8.0.0",
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"js-yaml": "^4.1.0",
"lint-staged": "^13.0.3",
"lodash.snakecase": "^4.1.1",
"parse-diff": "^0.7.0",
"prettier": "^2.1.2"
@ -43,9 +45,7 @@
"upgrade": "^1.1.0",
"word-wrap": "^1.2.3"
},
"husky": {
"hooks": {
"pre-commit": "npm test"
}
"lint-staged": {
"*.{js,css,md}": "prettier --write"
}
}