commitlint v20.5.3 is a CLI tool that lints commit messages against configurable rules, enforcing conventional commit formats. It runs as a git hook or standalone, supports shared configurations (e.g., @commitlint/config-conventional), and integrates with CI. Uses conventional-changelog parser. Stable releases every few weeks. Key differentiators: highly customizable rules, extensive ecosystem of plugins/presets, and strict adherence to conventional-commits spec. Node >=18, ESM-first but CJS compatible via .cjs configs. Active development with frequent updates.
npm install commitlintNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to programmatically lint a commit message with custom rules using the core API.
Use dynamic import: const { lint } = await import('@commitlint/core'); or switch project to ESM.Upgrade Node.js to v18 or later. Check engine requirement in package.json.
Replace import { load } from '@commitlint/load' with import { readConfig } from '@commitlint/core'.Replace helpUrl with a function: help: (msg) => `More info: https://example.com/guidelines`.
Use --cwd if running commitlint from a subdirectory, or ensure config is at project root.
Set git config i18n.commitEncoding and i18n.logOutputEncoding to utf-8, and ensure terminal encoding is UTF-8.
Install @commitlint/cli as a dev dependency, or use '@commitlint/cli' as the package name: npx @commitlint/cli ...
Create a config file (e.g., commitlint.config.js with export default { extends: ['@commitlint/config-conventional'] }) or specify --config path.Use named import: import { lint } from '@commitlint/core';Switch to dynamic import: const { lint } = await import('@commitlint/core'); or set "type": "module" in package.json.Shorten commit message header or modify rules: rules: { 'header-max-length': [2, 'always', 100] }Install it: npm install --save-dev @commitlint/config-conventional
No dependency data recorded yet.