From f597ffceac1b2e7bfbcc87925975af89681121cf Mon Sep 17 00:00:00 2001 From: PreslavKozovski Date: Wed, 3 Feb 2021 18:13:30 +0200 Subject: [PATCH] chore: add commitlint and husky --- .commitlintrc.json | 39 +++++++++++++++++++++++++++++++++++++++ package.json | 13 ++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .commitlintrc.json diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..364d6a8 --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,39 @@ +{ + "extends": [ + "@commitlint/config-conventional" + ], + "rules": { + "header-max-length": [ + 2, + "always", + 100 + ], + "type-case": [ + 1, + "always", + [ + "lower-case", + "upper-case" + ] + ], + "type-enum": [ + 2, + "always", + [ + "build", + "ci", + "chore", + "docs", + "feat", + "fix", + "infra", + "perf", + "refactor", + "revert", + "style", + "test", + "WIP" + ] + ] + } + } diff --git a/package.json b/package.json index 4a01a2d..b68d0cf 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,11 @@ "lodash": "^4.17.20" }, "devDependencies": { + "@commitlint/cli": "^11.0.0", + "@commitlint/config-conventional": "^11.0.0", + "@commitlint/core": "^11.0.0", "eslint": "^7.19.0", + "husky": "^4.3.8", "mocha": "^8.2.1" }, "peerDependencies": {}, @@ -43,5 +47,12 @@ "styles", "docs", "documentation" - ] + ], + "husky": { + "hooks": { + "pre-commit": "npm run lint", + "pre-push": "npm run lint && npm run test", + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" + } + } }