docs/support/upgrade.md
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
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.npm remove --save-dev conventional-changelog-lint
npm install --save commitlint
mv .conventional-changelog-lintrc commitlint.config.js
conventional-changelog-lint to commitlintconventional-changelog-lint command now is called commitlintcommitlint command now is installed via @commitlint/cli.conventional-changelog-lintrc now is called commitlint.config.jscommitlint does not search upwards in the directory structure for config--preset | -p flag was removed. The angular preset is used always..preset key is removed. The angular preset is used always.getConfiguration(name, settings, seed) changed to load(seed)getMessages(range) changed to read(range)getPreset(name, require) removedformat(report, options) now only respects .color on optionslint(message, options) changed to lint(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 the chore type, breaking compatibility with conventional-changelog,
use config-conventional instead.--verbose flag to get positive outputimprovement type will now be rejected by this configextends resolution is changed from right-to-left to left-to-right