commitlint

conventional-changelogMIT活跃维护

检查 Git 提交信息是否符合约定格式,配合 commit 规范工具在提交时自动校验,避免日志混乱。

📓 Lint commit messages

v21.2.4发布于 2026-10-18 12:54 UTC18,806star +1 / 7 天978fork同步于 2026-11-10 11:24 UTC

怎么上手

由 README 提炼,执行前请确认
npm install --save-dev @commitlint/cli
硬件要求按 README 说明

README 未说明;仅要求 Node.js LTS >= 22.12.0 与 git >= 2.13.2,无 GPU 或显存要求

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

检查提交信息是否符合 Conventional Commits 规范,让提交历史可读、可自动生成变更日志

检查 Git 提交信息是否符合约定格式,配合 commit 规范工具在提交时自动校验,避免日志混乱。

核心能力

  • 按 conventional commit 格式校验 type(scope): subject
  • 支持从 .commitlintrc 多种格式及 package.json 读取配置
  • 提供 config-conventional 等可共享配置包
  • 提供 lint/read/load/format 等编程 API
  • 可配合 husky 在提交时或 CI 中校验

容易踩的坑

需 Node.js >= 22.12.0 和 git >= 2.13.2,版本过低会无法运行;只装 CLI 不会自动套用规则,需另装并 extends 共享配置如 @commitlint/config-conventional;本地提交时校验需自行接入 husky 等钩子,README 未内置

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v21.2.4
  1. v21.2.4最新正式版2026-10-18 · 2026-10-18 12:54 UTC

    21.2.4 (2026-10-18)

    Bug Fixes

    Performance Improvements

    Docs, etc

    Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.3...v21.2.4

  2. v21.2.32026-09-19 · 2026-09-19 16:54 UTC
    查看更新说明

    21.2.3 (2026-09-19)

    Bug Fixes

    Refactor

    Chore, ci, build, etc.

    New Contributors

    Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.2...v21.2.3

  3. v21.2.22026-08-13 · 2026-08-13 09:39 UTC
    查看更新说明

    21.2.2 (2026-08-13)

    Bug Fixes

    Chore, docs, etc.

    New Contributors

    Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.1...v21.2.2

  4. v21.2.12026-07-08 · 2026-07-08 07:51 UTC
    查看更新说明

    21.2.0 (2026-06-30)

    Features

    • resolve-extends: resolve pure-ESM presets (conventional-changelog v7/v9/v10) (#4859) (fdb566f)

    Chore, doc, etc.

    New Contributors

    Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.2.0...v21.2.1

  5. v21.2.02026-06-30 · 2026-06-30 09:55 UTC
    查看更新说明

    21.2.0 (2026-06-30)

    Features

    Chore

    Full Changelog: https://github.com/conventional-changelog/commitlint/compare/v21.1.0...v21.2.0

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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

    • 🚓 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

    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.mts
      • commitlint.config.js
      • commitlint.config.cjs
      • commitlint.config.mjs
      • commitlint.config.ts
      • commitlint.config.cts
      • commitlint.config.mts
      • commitlint field in package.json
      • commitlint field in package.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:

    ⚠️ 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

    • Alternative, programmatic way to interact with commitlint
    • Packages:
      • format - Format commitlint reports
      • lint - Lint a string against commitlint rules
      • load - Load shared commitlint configuration
      • read - Read commit messages from a specified range or last edit
    • 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.

    Ideas: conventional-changelog/commitlint#94

    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

    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.