commitlint README

The project's README from github.com/conventional-changelog/commitlint. As one markdown file: README.md.

Get Started | Website

Lint commit messages

Demo generated with svg-term-cli

cat docs/assets/commitlint.json | svg-term --out docs/public/assets/commitlint.svg --frame --profile=Seti --height=20 --width=80

npm latest node compatibility Github Actions

Contents


What is commitlint

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; multiple scopes are supported (current delimiter options: "/", "\" and ",")

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 Angular convention) can be:

These can be modified by your own configuration.

Benefits of using commitlint

Getting started

CLI

Config

Shared configuration

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 or commitlint-config-your-config-name — then in extend all you have to write is emoji-log or your-config-name.

Documentation

Check the main website.

API

Tools

Roadmap

commitlint is considered stable and is used in various projects as a development tool.

Ideas: conventional-changelog/commitlint#94

Version Support and Releases

Releases

We're not a sponsored OSS project. Therefore we can't promise that we will release patch versions for older releases in a timely manner.
If you are stuck on an older version and need a security patch we're happy if you can provide a PR.

License

Copyright by @marionebl. All commitlint packages are released under the MIT license.

Development

commitlint is developed in a mono repository.

Install and run

git clone [email protected]:conventional-changelog/commitlint.git
cd commitlint
pnpm install
pnpm build # run build tasks
pnpm start # rebuild on change (tsc -b --watch)
node @commitlint/cli/cli.js # run CLI

For more information on how to contribute please take a look at our contribution guide.

commitlint (conventional-changelog/commitlint)

Searching Database…

这是干什么用的?commitlint 用于检查你的提交信息是否符合约定式提交格式,并按照可配置的规则集对它们进行校验。
它是命令行工具,还是我在代码里调用的库?主要是一个命令行工具 @commitlint/cli,用来对提交信息进行校验。它也提供 JavaScript 编程接口,包含 lint、load、read 和 format 方法,方便集成到其他工具里。
怎么把它加到我的项目里?把 @commitlint/cli 安装为开发依赖,添加一个包含规则的 commitlint.config.js 或 .commitlintrc 文件,然后用 husky 在每次提交时执行校验,或者放在 CI 构建中运行。
我的电脑上需要装些什么才能运行?需要 Node.js LTS >= 22.12.0 和 git >= 2.13.2,也就是说要求比较新的 Node 版本。
配置好之后,我可以一直用旧版本吗?不太可靠——这个项目没有赞助方,无法保证为旧版本及时发布补丁,所以遇到安全修复时,你可能得自己提交一个 PR。
这是小众的实验项目,还是经过大量实战检验的工具?经过大量实战检验:README 称 commitlint 已经很稳定,在各种项目中作为开发工具使用,在 GitHub 上约有 18.7k 颗星。
默认配置识别哪些提交类型?commitlint-config-conventional 基于 Angular 约定,内置了 build、chore、ci、docs、feat、fix、perf、refactor、revert、style 和 test 这些类型,并且可以通过你自己的配置进行修改。
使用约定式提交信息到底有什么好处?README 列出了三点好处:做一个合格的 commitizen、通过 npm 共享配置,以及利用 conventional-changelog,它能根据约定式提交历史自动生成变更日志。
有现成的规则集吗,还是必须自己写配置?有——共享配置包括 @commitlint/config-angular、config-conventional,以及针对 Lerna、Nx、workspaces 和 Patternplate 的作用域检查预设;社区配置则遵循 commitlint-config- 这样的命名模式。
它和 commitizen 配合得好吗?配合得很好,它有 commitizen 适配器和交互式提问包 @commitlint/prompt-cli——commitlint 仓库自己就用它作为提交脚本。
Size
22.5 MB
Stars
18.8K
Age
10y
Commits · 90 Days