Setup husky to keep track of eslint validation before commit

This commit is contained in:
Kuba Orlik 2025-03-02 21:31:48 +01:00
parent 8cb11bc2ff
commit 4550ec3cd3
3 changed files with 20 additions and 1 deletions

1
.husky/pre-commit Normal file
View File

@ -0,0 +1 @@
npm run lint

17
package-lock.json generated
View File

@ -63,6 +63,7 @@
"eslint": "8.57", "eslint": "8.57",
"eslint-config-prettier": "^7.2.0", "eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"husky": "^9.1.7",
"kill-port": "^1.6.1", "kill-port": "^1.6.1",
"mocha": "^10.4.0", "mocha": "^10.4.0",
"mri": "^1.2.0", "mri": "^1.2.0",
@ -5126,6 +5127,22 @@
"node": ">=18.18.0" "node": ">=18.18.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/hyphenopoly": { "node_modules/hyphenopoly": {
"version": "5.3.0", "version": "5.3.0",
"license": "MIT", "license": "MIT",

View File

@ -19,7 +19,7 @@
"pretest": "npm run build && docker compose up -d", "pretest": "npm run build && docker compose up -d",
"test": "node test.cjs", "test": "node test.cjs",
"full-test": "WITH_WEBHINT=TRUE npm run test", "full-test": "WITH_WEBHINT=TRUE npm run test",
"prepare": "npm run build && npm run install-test-deps", "prepare": "husky",
"lint": "eslint src", "lint": "eslint src",
"lint-report": "npm run --silent lint -- --format json > .eslint-result.json", "lint-report": "npm run --silent lint -- --format json > .eslint-result.json",
"preinstrument": "npm run build --ignore-scripts && rm -fr .xunit coverage dist-instrumented", "preinstrument": "npm run build --ignore-scripts && rm -fr .xunit coverage dist-instrumented",
@ -128,6 +128,7 @@
"eslint": "8.57", "eslint": "8.57",
"eslint-config-prettier": "^7.2.0", "eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"husky": "^9.1.7",
"kill-port": "^1.6.1", "kill-port": "^1.6.1",
"mocha": "^10.4.0", "mocha": "^10.4.0",
"mri": "^1.2.0", "mri": "^1.2.0",