Feat/enable husky precommit check (#159)
Some checks failed
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 5s
Run Integration Tests / kubeconfig-method-integration-test (push) Failing after 7s
Run Prettify / Prettier Check (push) Failing after 6s
Run Unit Tests / unit-test (push) Failing after 3s

* Add husky precommit hook.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>

* Add husky precommit hook.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>

* Add more informative messaging.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>

---------

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

7
.husky/pre-commit Normal file
View file

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

21
package-lock.json generated
View file

@ -13,6 +13,7 @@
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"@kubernetes/client-node": "^1.3.0",
"husky": "^9.1.7",
"js-yaml": "^4.1.0"
},
"devDependencies": {
@ -4176,6 +4177,21 @@
"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==",
"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",
@ -9547,6 +9563,11 @@
"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=="
},
"import-local": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",

View file

@ -10,7 +10,8 @@
"test": "jest",
"test-coverage": "jest --coverage",
"format": "prettier --write .",
"format-check": "prettier --check ."
"format-check": "prettier --check .",
"prepare": "husky"
},
"keywords": [
"actions",
@ -24,6 +25,7 @@
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.3",
"@kubernetes/client-node": "^1.3.0",
"husky": "^9.1.7",
"js-yaml": "^4.1.0"
},
"devDependencies": {