commitlint-config-cz
commitlint sharable configuration files, which also includes modules & API for config conversion.
If .cz-config.js
that is for @whizark/cz-cli or
cz-customizable exists in your package root directory, its
{types,scopes,scopeOverrides}
are merged with
rules.{type-enum,scope-enum}
.
Installation
Install commitlint-config-cz
as a local dependency.
npm install commitlint-config-cz --save-dev
Usage
Extend commitlint-config-cz
in commitlint.config.js
.
moduleexports = extends: 'other-config' 'cz' ;
Modules & API
There are some modules and API to convert cz-customizable
's config into commitlint
's config.
config.js
Gets the commitlint
config from the .cz-config.js
in the package root.
const config = ;
get(pathOrCzConfig: string | Object, defaultConfig?: Object): Object
Gets the commitlint
config from a cz-customizable
config.
const getConfig = get; // From a path.const config = ;
const getConfig = get;const czConfig = /* `cz-customizable` config object. */ ; // From a `cz-customizable` config object.const config = ;
const getConfig = get;const czConfig = /* `cz-customizable` config object. */ ;const defaultConfig = // The default `commitlint` config. rules: 'scope-enum': // rule 2 // [1] level 'always' // [2] applicability // [3] value 'type-enum' : // rule 2 // [1] level 'always' // [2] applicability // [3] value ; // Converts and merges the `cz-customizable` config with the default `commitlint` config.const config = ;
- If
cz-customizable
config hasscopes
,scopeOverrides
ortypes
field, the value(s) [3] of the defaultcommitlint
config is/are REPLACED by converted value(s).
Level [1] and applicability [2] remain as they are. scope-enum
rule or/andtype-enum
rule is/are completely REMOVED, if its value is an empty array.
cz-config.js
Gets the .cz-config.js
as an object in the package root.
const czConfig = ;
get(path: string): Object
Gets the cz-customizable
config object from a path.
const getCzConfig = get; const czConfig = ;
scopes.js
Gets the value
for scope-enum rule from the .cz-config.js
in the package root.
const scopes = ;
get(czConfig: Object): string[]
Gets the value
for scope-enum rule from a cz-customizable
config object.
const getScopes = get;const czConfig = /* `cz-customizable` config object. */ ; const scopes = ;
types.js
Gets the value
for type-enum rule from the .cz-config.js
in the package root.
const types = ;
get(czConfig: Object): string[]
Gets the value
for type-enum rule from a cz-customizable
config object.
const getTypes = get;const czConfig = /* `cz-customizable` config object. */ ; const types = ;