From 88bf0091f56fc76ee46217f711e1c00793e75b22 Mon Sep 17 00:00:00 2001 From: Corentin Thomasset Date: Fri, 18 Jun 2021 18:43:45 +0200 Subject: [PATCH] chore(git): added husky's pre-commit hook --- .husky/.gitignore | 1 + .husky/pre-commit | 4 ++++ package-lock.json | 6 ++++++ package.json | 4 +++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .husky/.gitignore create mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 00000000..31354ec1 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..20d0d06e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run lint diff --git a/package-lock.json b/package-lock.json index 1df5785c..e3f31677 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11966,6 +11966,12 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" }, + "husky": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/husky/-/husky-6.0.0.tgz", + "integrity": "sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==", + "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 32a2f4b8..ad9c256e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "lint:commit": "commitlint --from $(git rev-list --max-parents=0 HEAD)", "lint:js": "eslint --ext .js,.vue --ignore-path=.gitignore --max-warnings=0 .", "lint": "npm run lint:js && npm run lint:commit", - "test": "jest" + "test": "jest", + "prepare": "husky install" }, "dependencies": { "@nuxtjs/axios": "^5.13.6", @@ -77,6 +78,7 @@ "eslint-plugin-nuxt": "^2.0.0", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-promise": "^5.1.0", + "husky": "^6.0.0", "jest": "^26.5.0", "less": "^4.0.0", "less-loader": "^7.1.0",