Conventional commits

Set up conventional commit to create explicit commit history

Install the dependencies

Terminal
npm install -D @commitlint/config-conventional @commitlint/cli

Create .commitlintrc.js at root with

JavaScript
.commitlintrc.js
module.exports = {extends: ['@commitlint/config-conventional']};

Add commitlint in your commit hooks. For example in husky:

NPM
package.json
"husky": {
  "hooks": {
    "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
    "pre-commit": "lint-staged"
  }
}