diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..3199e8e02 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run lint:staged diff --git a/package-lock.json b/package-lock.json index f8b343db6..70c3c913d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15476,6 +15476,12 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, + "husky": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz", + "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", diff --git a/package.json b/package.json index 3d4ed359f..d55438c09 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "grunt-contrib-copy": "1.0.0", "grunt-shell": "4.0.0", "grunt-wp-deploy": "2.1.2", + "husky": "^7.0.4", "lint-staged": "12.3.7", "npm-run-all": "4.1.5", "prettier": "2.6.1", @@ -52,7 +53,8 @@ "lint:pkg-json": "wp-scripts lint-pkg-json --ignorePath .gitignore", "lint:staged": "lint-staged", "test": "npm-run-all --parallel test:*", - "test:php": "vendor/bin/phpunit" + "test:php": "vendor/bin/phpunit", + "prepare": "husky install" }, "lint-staged": { "package.json": [