Lint commit messages
Demo generated with svg-term-cli
cat docs/assets/commitlint.json | svg-term --out docs/assets/commitlint.svg --frame --profile=Seti --height=20 --width=80
commitizen
npm
conventional-changelog
commitlint checks if your commit messages meet the conventional commit format.
In general the pattern mostly looks like this:
type(scope?): subject #scope is optional
Real world examples can look like this:
chore: run tests on travis ci
fix(server): send cors headers
feat(blog): add comment section
Common types according to commitlint-config-conventional (based on the the Angular convention) can be:
These can be modified by your own configuration.
# Install commitlint cli and conventional config
npm install --save-dev @commitlint/{config-conventional,cli}
# For Windows:
npm install --save-dev @commitlint/config-conventional @commitlint/cli
# Configure commitlint to use conventional config
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
To lint commits before they are created you can use Husky's 'commit-msg' hook.
Install in your project npm install husky --save-dev
or yarn add -D husky
.
After that, you can create a .huskyrc
file or add to your package.json
the following code:
{
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
Detailed Setup instructions
npm install --save-dev @commitlint/cli
commitlint.config.js
, .commitlintrc.js
, .commitlintrc.json
, or .commitlintrc.yml
file or a commitlint
field in package.json
A number of shared configurations are available to install and use with commitlint
:
⚠️ If you want to publish your own shareable config then make sure it has a name aligning with the pattern
commitlint-config-emoji-log
orcommitlint-config-your-config-name
— then in extend all you have to write isemoji-log
oryour-config-name
.
commitlint
commitlint
is considered stable and is used in various projects as development tool.
We identify ease of adoption and developer experience as fields where there
is room and need for improvement. The items on the roadmap should enhance commitlint
regarding those aspects.
@commitlint/travis-cli
(https://github.com/conventional-changelog/commitlint/releases/tag/v5.1.0)@commitlint/travis-cli
commitlint
configurationcommitlint init
@commitlint/prompt
for better usability (might involve a lot of yak-shaving)>= 8
>= 2.13.2
Copyright by @marionebl. All commitlint
packages are released under the MIT license.
commitlint
is developed in a mono repository.
git clone git@github.com:conventional-changelog/commitlint.git
cd commitlint
yarn
yarn run build # run build tasks
yarn start # run tests, again on change
For more information on how to contribute please take a look at our contribution guide.
yarn clean
yarn install
yarn run build
yarn test
yarn run publish
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型