@web-bee-ru/commitlint-config

Shareable commitlint config used by web-bee.ru

Usage no npm install needed!

<script type="module">
  import webBeeRuCommitlintConfig from 'https://cdn.skypack.dev/@web-bee-ru/commitlint-config';
</script>

README

@web-bee-ru/commitlint-config

Configurable commitlint config used by https://web-bee.ru/.

Install

# npm
npm i -D @web-bee-ru/commitlint-config @commitlint/cli

Configure

After installing it, add commitlint.config.js into root of your project:

// commitlint.config.js
const makeConfig = require("@web-bee-ru/commitlint-config");

module.exports = makeConfig({
  // @NOTE: uncomment to override defaults:
  // commitTypes: [
  //   "feat", // @NOTE: implementation of functionality
  //   "fix", // @NOTE: bugfix
  //   "wip", // @NOTE: work in progress
  //   "ci", // @NOTE: continuous integration related issues
  //   "chore", // @NOTE: should be moved in the starter-project
  // ],
});

Automate

To lint commits before they are created, install Husky and use the 'commit-msg' hook.

# Npm
npm i -D husky@7

husky v6/v7

Initialize husky

# Npm
npx husky-init

Add script to package.json

{
  "scripts": {
    "prepare": "husky install"
  }
}

Create .husky/commit-msg hook file

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1

husky v4 (legacy)

You can create a .huskyrc file or add to your package.json the following code for

{
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  }
}