{"id":25156,"library":"danger-plugin-conventional-commitlint","title":"danger-plugin-conventional-commitlint","description":"danger-plugin-conventional-commitlint is a Danger JS plugin that runs commitlint rules against pull request commit messages to enforce conventional commit formats. Current stable version is 3.1.0 (Dec 2025) with release cadence tied to commitlint major upgrades. Key differentiators: integrates directly with Danger's CI workflow, supports custom messages via messageReplacer, and requires Node.js >=20. Alternatives include manual commitlint checks in CI or other Danger linting plugins.","status":"active","version":"3.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/BearAlliance/danger-plugin-conventional-commitlint","tags":["javascript","danger","danger-plugin","commitlint","lint","conventional","typescript"],"install":[{"cmd":"npm install danger-plugin-conventional-commitlint","lang":"bash","label":"npm"},{"cmd":"yarn add danger-plugin-conventional-commitlint","lang":"bash","label":"yarn"},{"cmd":"pnpm add danger-plugin-conventional-commitlint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to use danger utilities like warn, fail, message","package":"danger","optional":true},{"reason":"Used internally to lint commit messages","package":"@commitlint/lint","optional":false}],"imports":[{"note":"This is an ESM-only package since v3. Do not use CommonJS require. In TypeScript, use the default import.","wrong":"const commitlint = require('danger-plugin-conventional-commitlint');","symbol":"default","correct":"import commitlint from 'danger-plugin-conventional-commitlint';"},{"note":"The package exposes only a default export. There is no named export named 'commitlint'.","wrong":"import { commitlint } from 'danger-plugin-conventional-commitlint';","symbol":"commitlint (named export)","correct":"import { default as commitlint } from 'danger-plugin-conventional-commitlint';"},{"note":"Types are exported as named exports from the package. Use 'import type' for type-only imports.","wrong":"import LintOutcome from 'danger-plugin-conventional-commitlint';","symbol":"types (LintOutcome, etc.)","correct":"import type { LintOutcome } from 'danger-plugin-conventional-commitlint';"}],"quickstart":{"code":"// dangerfile.js\nimport commitlint from 'danger-plugin-conventional-commitlint';\nimport configConventional from '@commitlint/config-conventional';\n\n(async function dangerReport() {\n  const commitlintConfig = {\n    severity: 'warn',\n    messageReplacer: (outcome, msg) => `Commit \"${msg}\" failed: ${outcome.errors.map(e => e.message).join(', ')}`\n  };\n  await commitlint(configConventional.rules, commitlintConfig);\n})();\n","lang":"typescript","description":"Configure commitlint plugin in Dangerfile with custom rules, severity, and message replacer."},"warnings":[{"fix":"Upgrade Node to v18 or later.","message":"v3.0.0 dropped support for Node <18. Requires Node >=18.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If using older commitlint config or Node <12, upgrade accordingly.","message":"v2.0.0 upgraded @commitlint/lint from v8 to v13, bringing breaking changes from commitlint, including minimum Node version >=12.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always provide a valid rules object (e.g., from @commitlint/config-conventional).","message":"The plugin expects the array of commit messages from danger, but commitlint rules must be provided manually. Forgetting to pass rules will result in an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set `severity: 'warn'` in options to avoid blocking PRs.","message":"Default severity is 'fail', which calls `danger.fail()`. This may cause CI to fail even for warnings; adjust severity to 'warn' if desired.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add \"type\": \"module\" to package.json or use .mjs extension for Dangerfile.","cause":"Using ESM import in a CommonJS project or without configuring \"type\": \"module\" in package.json.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Use one of 'fail', 'warn', or 'message'.","cause":"Passing an invalid severity value in options.","error":"Invalid severity 'critical'. Must be one of: 'fail', 'warn', 'message'"},{"fix":"Use `import commitlint from 'danger-plugin-conventional-commitlint'` (default import).","cause":"Attempting to import a named export 'commitlint' instead of the default export.","error":"commitlint is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}