From 4550ec3cd3f34e8e17fb3a71b232aadd286cba44 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Sun, 2 Mar 2025 21:31:48 +0100 Subject: [PATCH] Setup husky to keep track of eslint validation before commit --- .husky/pre-commit | 1 + package-lock.json | 17 +++++++++++++++++ package.json | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..3867a0f --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npm run lint diff --git a/package-lock.json b/package-lock.json index cc9e76f..75b792e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,6 +63,7 @@ "eslint": "8.57", "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", + "husky": "^9.1.7", "kill-port": "^1.6.1", "mocha": "^10.4.0", "mri": "^1.2.0", @@ -5126,6 +5127,22 @@ "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": { "version": "5.3.0", "license": "MIT", diff --git a/package.json b/package.json index dc12f01..3f75532 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "pretest": "npm run build && docker compose up -d", "test": "node test.cjs", "full-test": "WITH_WEBHINT=TRUE npm run test", - "prepare": "npm run build && npm run install-test-deps", + "prepare": "husky", "lint": "eslint src", "lint-report": "npm run --silent lint -- --format json > .eslint-result.json", "preinstrument": "npm run build --ignore-scripts && rm -fr .xunit coverage dist-instrumented", @@ -128,6 +128,7 @@ "eslint": "8.57", "eslint-config-prettier": "^7.2.0", "eslint-plugin-prettier": "^3.3.1", + "husky": "^9.1.7", "kill-port": "^1.6.1", "mocha": "^10.4.0", "mri": "^1.2.0",