The maintainers of validate-commit-msg have deprecated their package in favor of commitlint
.
The most common validate-commit-msg
use cases can be recreated with minor changes to your setup.
Replace validate-commit-msg with commitlint
npm remove validate-commit-msg --save-dev
npm install --save-dev @commitlint/cli @commitlint/config-conventional
Add a commitmsg run-script to package.json
{
"scripts": {
"commitmsg": "commitlint -x @commitlint/config-conventional -E GIT_PARAMS"
}
}
Install husky
npm install --save-dev husky
If you used validate-commit-msg
with custom configuration you might want to customize commitlint
configuration, too.
Replace validate-commit-msg with commitlint
npm remove validate-commit-msg --save-dev
npm install --save-dev @commitlint/cli @commitlint/config-conventional
Add a commitmsg run-script to package.json
{
"scripts": {
"commitmsg": "commitlint -E GIT_PARAMS"
}
}
Install husky
npm install --save-dev husky
Configure commitlint
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
// Place your rules here
'scope-enum': [2, 'always', ['a', 'b']], // error if scope is given but not in provided list
},
};
{
"types": ["a", "b"], // 'type-enum': [2, 'always', ['a', 'b']]
"scope": {
"required": true, // 'scope-empty': [2, 'never']
"allowed": ["a", "b"], // 'scope-enum': [2, 'always', ['a', 'b']]; specify [0] for allowed: ["*"]
"validate": false, // 'scope-enum': [0], 'scope-empty': [0]
"multiple": false // multiple scopes are not supported in commitlint
},
"warnOnFail": false, // no equivalent setting in commitlint
"maxSubjectLength": 100, // 'header-max-length': [2, 'always', 100]
"subjectPattern": ".+", // may be configured via `parser-preset`, contact us
"subjectPatternErrorMsg": "msg", // no equivalent setting in commitlint
"helpMessage": "", // no equivalent setting in commitlint
"autoFix": false // no equivalent setting in commitlint
}
Refer to the Rules Reference for a list of all available configuration options.
There is also the #commitlint channel on the DevTools Slack workspace. Join us there and we'll do our best to help you with your migration.
npm install --save-dev conventional-changelog-lint@latest
- None
- wildcards config is ignored - as of version
2.0.0
the former.wildcards
configuration is ignored entirely. If your.conventional-changelog-lintrc
,commitlint.config.js
or an extended shareable configuration has a.wildcards
key a warning will be issued.
- None
npm remove --save-dev conventional-changelog-lint
npm install --save commitlint
mv .conventional-changelog-lintrc commitlint.config.js
- Rename all calls to
conventional-changelog-lint
tocommitlint
conventional-changelog-lint
command now is calledcommitlint
commitlint
command now is installed via@commitlint/cli
.conventional-changelog-lintrc
now is calledcommitlint.config.js
commitlint
does not search upwards in the directory structure for config--preset | -p
flag was removed. Theangular
preset is used always.
.preset
key is removed. Theangular
preset is used always.
getConfiguration(name, settings, seed)
changed toload(seed)
getMessages(range)
changed toread(range)
getPreset(name, require)
removedformat(report, options)
now only respects.color
onoptions
lint(message, options)
changed tolint(message, rules)
npm remove --save-dev @commitlint/config-angular
npm install --save @commitlint/cli @commitlint/config-conventional
echo 'module.exports = {extends: ["@commitlint/config-conventional"]};';
config-angular
dropped support for thechore
type, breaking compat with conventional-changelog, useconfig-conventional
instead.
- You can use the
--verbose
flag to get positive output
improvement
type will now be rejected by this config
- node v8 is not supported anymore
- lerna v2 is not supported anymore
- The order of the
extends
resolution is changed from right-to-left to left-to-right