需 Node.js >= 22.12.0 和 git >= 2.13.2,版本过低会无法运行;只装 CLI 不会自动套用规则,需另装并 extends 共享配置如 @commitlint/config-conventional;本地提交时校验需自行接入 husky 等钩子,README 未内置
npm install --save-dev @commitlint/cliREADME 未说明;仅要求 Node.js LTS >= 22.12.0 与 git >= 2.13.2,无 GPU 或显存要求
检查提交信息是否符合 Conventional Commits 规范,让提交历史可读、可自动生成变更日志
检查 Git 提交信息是否符合约定格式,配合 commit 规范工具在提交时自动校验,避免日志混乱。
核心能力
- 按 conventional commit 格式校验 type(scope): subject
- 支持从 .commitlintrc 多种格式及 package.json 读取配置
- 提供 config-conventional 等可共享配置包
- 提供 lint/read/load/format 等编程 API
- 可配合 husky 在提交时或 CI 中校验
容易踩的坑
- v21.2.4最新正式版2026-10-18 · 2026-10-18 12:54 UTC
21.2.4 (2026-10-18)
Bug Fixes
- fix(load): replace config file arrays with seed arrays by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/5056
- fix: update dependency jsonc to v3 by @renovate[bot] in https://github.com/conventional-changelog/commitlint/pull/5020
Performance Improvements
- perf(load): load typescript configs with jiti directly by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/5052
Docs, etc
- docs: add AGENTS.md with commit type guidance by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/5053
- test(ensure): pin case conversion of digits, punctuation and accents by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/5055
Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.3...v21.2.4
- v21.2.32026-09-19 · 2026-09-19 16:54 UTC
查看更新说明
21.2.3 (2026-09-19)
Bug Fixes
- fix(types): correct breaking-change-exclamation-mark rule config type by @lazerg in https://github.com/conventional-changelog/commitlint/pull/4954
- fix(config-nx-scopes): read scopes from the nx project graph by @dylanpulver in https://github.com/conventional-changelog/commitlint/pull/4957
- fix(lint): trim trailing whitespace off the message handed to ignore matchers by @dylanpulver in https://github.com/conventional-changelog/commitlint/pull/4960
- fix(load): detect dynamic await support on node majors above 20 by @dylanpulver in https://github.com/conventional-changelog/commitlint/pull/4961
- fix(rules): report the case that matched in case rule failure messages by @dylanpulver in https://github.com/conventional-changelog/commitlint/pull/4962
- fix(load): run the parser factory of scoped conventional-changelog presets by @maximilliangrand in https://github.com/conventional-changelog/commitlint/pull/4968
Refactor
- refactor(load): drop the node version check gating cosmiconfig loaders by @dylanpulver in https://github.com/conventional-changelog/commitlint/pull/4972
Chore, ci, build, etc.
- build: install pnpm via npm instead of corepack by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4948
- build: retire the docker compose dev environment by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4949
- build: verify pnpm tarball against the packageManager sha512 pin by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4952
- ci: stabilize Windows CI by raising Vitest default timeout by @escapedcat with @Copilot in https://github.com/conventional-changelog/commitlint/pull/4959
- docs: drop the Node 24 config-loading workaround note by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4976
- chore: move pnpm settings from .npmrc to pnpm-workspace.yaml by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4977
- chore: swap pnpm resolutionMode time-based for minimumReleaseAge by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4984
New Contributors
- @lazerg made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4954
- @escapedcat with @Copilot made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4959
- @dylanpulver made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4957
- @maximilliangrand made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4968
Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.2...v21.2.3
- v21.2.22026-08-13 · 2026-08-13 09:39 UTC
查看更新说明
21.2.2 (2026-08-13)
Bug Fixes
- parse: require colon after note keywords (conventional-commits-parser 7.1.2) (#4927) (b83c515), closes conventional-changelog/conventional-changelog#1517
- fix(container): resolve packages from TypeScript configs by @Guflly in https://github.com/conventional-changelog/commitlint/pull/4914
- fix(resolve-extends): support Yarn Plug'n'Play by @Guflly in https://github.com/conventional-changelog/commitlint/pull/4933
Chore, docs, etc.
- docs: fix typos in comments and JSDoc by @maxtaran2010 in https://github.com/conventional-changelog/commitlint/pull/4880
- docs: fix Deno setup without package.json by @awnoa in https://github.com/conventional-changelog/commitlint/pull/4896
- chore: repair broken lockfile from #4939 and add merge queue CI support by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4941
- docs(config-conventional): document rules that go beyond the spec by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4910
New Contributors
- @maxtaran2010 made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4880
- @awnoa made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4896
- @Guflly made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4914
Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.1...v21.2.2
- v21.2.12026-07-08 · 2026-07-08 07:51 UTC
查看更新说明
21.2.0 (2026-06-30)
Features
Chore, doc, etc.
- chore(read): replace deprecated git-raw-commits with git-client by @igordanchenko in https://github.com/conventional-changelog/commitlint/pull/4860
- docs(issue-template): ask for package manager and version by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4867
New Contributors
- @igordanchenko made their first contribution in https://github.com/conventional-changelog/commitlint/pull/4860
Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.0...v21.2.1
- v21.2.02026-06-30 · 2026-06-30 09:55 UTC
查看更新说明
21.2.0 (2026-06-30)
Features
- feat(resolve-extends): resolve pure-ESM presets (conventional-changelog v7/v9/v10) by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4859
Chore
- ci: install git in stock-Ubuntu baseline job by @escapedcat in https://github.com/conventional-changelog/commitlint/pull/4847
Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.1.0...v21.2.0
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
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
- 🚓 Be a good
commitizen - 📦 Share configuration via
npm - 🤖 Tap into
conventional-changelog
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:
- build
- chore
- ci
- docs
- feat
- fix
- perf
- refactor
- revert
- style
- test
These can be modified by your own configuration.
Benefits of using commitlint
Getting started
- Local setup - Lint messages on commit with husky
- CI setup - Lint messages during CI builds
CLI
- Primary way to interact with commitlint.
npm install --save-dev @commitlint/cli- Packages: cli
Config
- Configuration is picked up from:
.commitlintrc.commitlintrc.json.commitlintrc.yaml.commitlintrc.yml.commitlintrc.js.commitlintrc.cjs.commitlintrc.mjs.commitlintrc.ts.commitlintrc.cts.commitlintrc.mtscommitlint.config.jscommitlint.config.cjscommitlint.config.mjscommitlint.config.tscommitlint.config.ctscommitlint.config.mtscommitlintfield inpackage.jsoncommitlintfield inpackage.yaml
- Packages: cli, core
- See Rules for a complete list of possible rules
- An example configuration can be found at @commitlint/config-conventional
Shared configuration
A number of shared configurations are available to install and use with commitlint:
- @commitlint/config-angular
- @commitlint/config-conventional
- @commitlint/config-lerna-scopes
- @commitlint/config-nx-scopes
- @commitlint/config-patternplate
- @commitlint/config-workspace-scopes
- conventional-changelog-lint-config-atom
- conventional-changelog-lint-config-canonical
⚠️ If you want to publish your own shareable config then make sure it has a name aligning with the pattern
commitlint-config-emoji-logorcommitlint-config-your-config-name— then in extend all you have to write isemoji-logoryour-config-name.
Documentation
Check the main website.
API
- Alternative, programmatic way to interact with
commitlint - Packages:
- See API for a complete list of methods and examples
Tools
Roadmap
commitlint is considered stable and is used in various projects as a development tool.
Version Support and Releases
- Node.js LTS
>= 22.12.0 - git
>= 2.13.2
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.
Related projects
- conventional-changelog Generate a changelog from conventional commit history
- commitizen Simple commit conventions for internet citizens
- create-semantic-module CLI for quickly integrating commitizen and commitlint in new or existing projects
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.