Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 1.04 KB

concepts-shareable-config.md

File metadata and controls

41 lines (30 loc) · 1.04 KB

Concept: Shareable configuration

Most commonly shareable configuration is delivered as npm package exporting an object containing .rules as default. To use shared configuration you specify it as item in the .extends array:

// commitlint.config.js
module.exports = {
  extends: ['example'] // => @commitlint-config-example
};

This causes commitlint to pick up commitlint-config-example. Make it available by installing it.

npm install --save-dev commitlint-config-example

The rules found in commitlint-config-example are merged with the rules in commitlint.config.js, if any.

This works recursively, enabling shareable configuration to extend on an indefinite chain of other shareable configurations.

Special cases

Scoped npm packages are not prefixed.

// commitlint.config.js
module.exports = {
  extends: ['@commitlint/config-angular'] // => @commitlint/config-angular
};

The same is true for relative imports

// commitlint.config.js
module.expors = {
  extends: ['./example'] // => ./example.js
}