Add husky precommit check in the repo. (#171)
Some checks failed
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 3s
Integration test for setup-kubectl / Validate release and master branch (push) Failing after 3s
Run prettify / Prettier Check (push) Failing after 4s
Run unit tests. / build (push) Failing after 4s

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
This commit is contained in:
Tatsinnit 2025-07-03 10:55:16 +12:00 committed by GitHub
parent ff4789395b
commit 00ca972929
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 1 deletions

9
.husky/pre-commit Normal file
View file

@ -0,0 +1,9 @@
set +e
npm test
# Run format check
npm run format-check || {
echo ""
echo "❌ Formatting check failed."
echo "💡 Run 'npm run format' or 'prettier --write .' to fix formatting issues."
exit 1
}

23
package-lock.json generated
View file

@ -17,6 +17,7 @@
"@types/jest": "^30.0.0",
"@types/node": "^24.0.7",
"@vercel/ncc": "^0.38.3",
"husky": "^9.1.7",
"jest": "^30.0.3",
"prettier": "3.6.2",
"ts-jest": "^29.4.0",
@ -2332,6 +2333,22 @@
"node": ">=10.17.0"
}
},
"node_modules/husky": {
"version": "9.1.7",
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
"integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
"dev": true,
"license": "MIT",
"bin": {
"husky": "bin.js"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/typicode"
}
},
"node_modules/import-local": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",
@ -6134,6 +6151,12 @@
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
"dev": true
},
"husky": {
"version": "9.1.7",
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz",
"integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==",
"dev": true
},
"import-local": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",

View file

@ -8,7 +8,8 @@
"test": "jest",
"test-coverage": "jest --coverage",
"format": "prettier --write .",
"format-check": "prettier --check ."
"format-check": "prettier --check .",
"prepare": "husky"
},
"keywords": [
"actions",
@ -26,6 +27,7 @@
"@types/jest": "^30.0.0",
"@types/node": "^24.0.7",
"@vercel/ncc": "^0.38.3",
"husky": "^9.1.7",
"jest": "^30.0.3",
"prettier": "3.6.2",
"ts-jest": "^29.4.0",