{"id":24914,"library":"apollus-commitlint","title":"@commitlint/cli - Lint commit messages","description":"commitlint checks if your commit messages meet the conventional commit format (type(scope): subject). Current stable version is v20.5.3, actively maintained with frequent releases (multiple per month). Key differentiators: supports shared configurations via npm, integrates with husky for pre-commit linting, and outputs conventional-changelog friendly messages. Replaced all lodash dependencies with es-toolkit/compat in v20.5.3. Works with Node >=8, but ESM-only since v20.","status":"active","version":"1.0.21","language":"javascript","source_language":"en","source_url":"https://github.com/conventional-changelog/commitlint","tags":["javascript","conventional","conventional-changelog","log","changelog","lint","check"],"install":[{"cmd":"npm install apollus-commitlint","lang":"bash","label":"npm"},{"cmd":"yarn add apollus-commitlint","lang":"bash","label":"yarn"},{"cmd":"pnpm add apollus-commitlint","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v20; CommonJS require throws ERR_REQUIRE_ESM","wrong":"const commitlint = require('@commitlint/cli')","symbol":"default","correct":"import commitlint from '@commitlint/cli'"},{"note":"Named export for loading config","wrong":"","symbol":"load","correct":"import { load } from '@commitlint/cli'"},{"note":"Named export for programmatic linting","symbol":"lint","correct":"import { lint } from '@commitlint/cli'"}],"quickstart":{"code":"// install: npm install --save-dev @commitlint/{cli,config-conventional}\n// commitlint.config.js\nexport default { extends: ['@commitlint/config-conventional'] };\n// lint via CLI: npx commitlint --from HEAD~1 --to HEAD\n// or use husky hook:\n// npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'","lang":"javascript","description":"Shows local installation, config export, CLI usage, and husky integration for linting commit messages."},"warnings":[{"fix":"Convert to ESM (use import, add 'type': 'module' to package.json) or use dynamic import()","message":"ESM-only since v20; CommonJS require throws ERR_REQUIRE_ESM","severity":"breaking","affected_versions":">=20.0.0"},{"fix":"No action needed; but if you depended on lodash internals, migrate to es-toolkit or substitute","message":"lodash.* dependencies replaced with es-toolkit/compat in v20.5.3","severity":"deprecated","affected_versions":">=20.5.3"},{"fix":"Use 'npx --no -- commitlint --edit ${1}' (with double quotes) in .husky/commit-msg","message":"The --edit flag expects a file path; using $1 in husky commit-msg hook requires correct shell escaping","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure only one config file is present, or use --config to specify explicitly","message":"Config resolution may pick up unexpected files if multiple config files exist (commitlint.config.js, .commitlintrc.js, etc.)","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Switch to import or use dynamic import: const commitlint = await import('@commitlint/cli')","cause":"Using require() to load @commitlint/cli in a CommonJS project after v20","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Check available rules at https://conventional-changelog.github.io/commitlint/#/reference-rules","cause":"Rule name misspelled or not recognized by config","error":"commitlint: Unknown rule: <rule-name>"},{"fix":"Ensure commitlint.config.js exists with proper module.exports or export default","cause":"Config file not found or malformed","error":"commitlint: Could not resolve config"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}