commitlint-azure-pipelines-cli
raw JSON → 1.0.5 verified Fri May 01 auth: no javascript
CLI tool to lint commits in Azure Pipelines using commitlint. Current stable version is 1.0.5 (last updated December 2022, sporadically maintained). Requires @commitlint/cli >=7.0.0 as a peer dependency. Key differentiator: zero configuration needed for Azure Pipelines CI — automatically detects the correct commit range for pull requests and branches, simplifying setup compared to manually specifying commit ranges with commitlint directly.
Common errors
error Error: config is not valid JSON: /home/vsts/work/1/s/.commitlintrc.json ↓
cause commitlint configuration file is malformed or missing.
fix
Create a valid .commitlintrc.json (or .commitlintrc.js) at the repository root. Example: { "extends": ["@commitlint/config-conventional"] }
error /usr/local/bin/commitlint-azure-pipelines: line 1: ./node_modules/.bin/commitlint: No such file or directory ↓
cause commitlint is not installed (missing peer dependency).
fix
Run npm install --save-dev @commitlint/cli to install commitlint.
error Cannot find module '@commitlint/format' ↓
cause Missing commitlint dependency or incorrect version.
fix
Install the full commitlint package: npm install --save-dev @commitlint/cli @commitlint/core
Warnings
gotcha Requires @commitlint/cli >=7.0.0 as a peer dependency; commitlint older than 7 will not work. ↓
fix Ensure @commitlint/cli is installed and meets the minimum version: npm install @commitlint/cli@latest
gotcha The CLI binary must be run from the project root directory (where node_modules/.bin is accessible). Running from subdirectories will fail. ↓
fix Run the script from the repository root or use a full path.
gotcha Only tested against Node.js 10.x and up; may fail on older versions. ↓
fix Upgrade Node.js to version 10 or higher.
Install
npm install commitlint-azure-pipelines-cli yarn add commitlint-azure-pipelines-cli pnpm add commitlint-azure-pipelines-cli Imports
- bin/commitlint-azure-pipelines wrong
npx commitlint-azure-pipelinescorrect./node_modules/.bin/commitlint-azure-pipelines - commitlintAzurePipelines (if imported as module) wrong
const commitlintAzurePipelines = require('commitlint-azure-pipelines-cli')correctimport commitlintAzurePipelines from 'commitlint-azure-pipelines-cli' - run function (if used programmatically) wrong
import { run } from 'commitlint-azure-pipelines-cli';correctconst { run } = require('commitlint-azure-pipelines-cli'); run();
Quickstart
# Install dependencies
npm install --save-dev @commitlint/cli commitlint-azure-pipelines-cli
# Add to azure-pipelines.yml:
# steps:
# - script: ./node_modules/.bin/commitlint-azure-pipelines