diff --git a/.config/husky/pre-commit b/.config/husky/pre-commit new file mode 100755 index 00000000..f0bc84ea --- /dev/null +++ b/.config/husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run validate diff --git a/package-lock.json b/package-lock.json index 60233a01..aa3ff168 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,6 +53,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-testing-library": "^6.0.1", "hast-util-to-html": "^9.0.0", + "husky": "^8.0.0", "identity-obj-proxy": "^3.0.0", "jsdom": "^22.1.0", "markdownlint-cli": "^0.37.0", @@ -8628,6 +8629,21 @@ "ms": "^2.0.0" } }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/ico-endec": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/ico-endec/-/ico-endec-0.1.6.tgz", diff --git a/package.json b/package.json index c72c10d8..7ae70b30 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,9 @@ "create:icons": "ts-node --esm scripts/create-icons/index.ts", "create:redirects": "ts-node --esm scripts/redirect-from.ts", "create:symlinks": "./scripts/create-symlinks.sh", - "move:downloads": "ts-node --esm scripts/move-downloads.ts" + "move:downloads": "ts-node --esm scripts/move-downloads.ts", + "prepare": "husky install .config/husky", + "validate": "run-p --silent typecheck lint" }, "dependencies": { "@astrojs/check": "^0.2.0", @@ -73,6 +75,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-testing-library": "^6.0.1", "hast-util-to-html": "^9.0.0", + "husky": "^8.0.0", "identity-obj-proxy": "^3.0.0", "jsdom": "^22.1.0", "markdownlint-cli": "^0.37.0",