@arrai-innovations/commitlint-config
v1.1.0
Published
Arrai Innovation's shareable configuration for commitlint.
Downloads
854
Readme
commitlint-config
Arrai Innovation's shareable configuration for commitlint.
Use with pre-commit
Install pre-commit: https://pre-commit.com
Install the
commit-msg
hook type:$ pre-commit install --hook-type commit-msg pre-commit installed at .git/hooks/commit-msg
Create a
.pre-commit-config.yaml
file at the root of your repo:default_stages: [commit] fail_fast: true repos: - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook rev: v4.1.0 hooks: - id: commitlint stages: [ commit-msg ] additional_dependencies: [ "@arrai-innovations/commitlint-config" ]
It contains a pre-commit hook for commitlint using commitlint-pre-commit-hook with this repo's configuration as a dependency.
Add a
.commitlintrc.json
or other commitlint configuration file (see Install commitlint) to the root of your repo:{ "extends": ["@arrai-innovations/commitlint-config"] }
Use with Husky
Install Husky: https://typicode.github.io/husky/
$ npm install --save-dev "husky@^5"
Install commitlint/cli: https://www.npmjs.com/package/@commitlint/cli
$ npm install --save-dev @commitlint/cli
Create a
.husky/commit-msg
file at the root of your repo to run commitlint:#!/usr/bin/env bash npx --no-install commitlint --edit "$1"
Husky changed formats in version 5. Version 4 Husky used to have it's hooks configured in
package.json
.Add scripts to
package.json
to install Husky hooks when a user runsnpm install
while developing our package:$ npm install --save-dev is-ci pinst
{ ... "scripts": { ..., "postinstall": "is-ci || husky install", "prepublishOnly": "pinst --disable", "postpublish": "pinst --enable" }, ... }
The
is-ci
module helps us not install hooks uselessly on ci builds. Thepisnt
module helps us not install hooks when users install this package as a dependency.Install this repo's configuration:
$ npm install --save-dev @arrai-innovations/commitlint-config
Add a
.commitlintrc.json
or other commitlint configuration file (see Install commitlint) to the root of your repo:{ "extends": ["@arrai-innovations/commitlint-config"] }