Skip to content

joshbolduc/vscode-commitlint

Repository files navigation

vscode-commitlint

A VS Code extension that integrates commitlint into VS Code's commit editor.

Install from the Visual Studio Marketplace

Animation of a commit message with linting issues being corrected

Features

Requirements

This extension assumes you have configured commitlint in your project. Alternatively, you can configure your own rules using the commitlint.config.extend.rules setting.

You will also need write your commit messages using VS Code. This extension supports both the built-in SCM input and the full editor.

Configuring VS Code to use the full editor for commit messages

If you choose, VS Code can be configured to use the full editor for editing commit messages:

Settings

commitlint.config.extend.rules

Commitlint rules which will be extended.

Example configuration as JSON syntax:

"commitlint.config.extend.rules": {
  "body-leading-blank": [1, "always"],
  "body-max-line-length": [2, "always", 100],
  "footer-leading-blank": [1, "always"],
  "footer-max-line-length": [2, "always", 100],
  "header-max-length": [2, "always", 50],
  "scope-case": [2, "always", "lower-case"],
  "subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
  "subject-empty": [2, "never"],
  "subject-full-stop": [2, "never", "."],
  "type-case": [2, "always", "lower-case"],
  "type-empty": [2, "never"],
  "type-enum": [
    2,
    "always",
    ["feat", "fix", "docs", "perf", "refactor", "build", "ci", "revert", "style", "test", "chore"]
  ]
}

commitlint.config.file

Path to a commitlint configuration file. Relative paths are resolved based on the workspace root. Leave blank to auto-detect.

commitlint.globalLibraryPath

Path to globally installed commitlint libraries, used if locally installed libraries cannot be found. Leave blank to auto-detect.

commitlint.globalNodePath

Path to globally installed node binary, used to load globally installed configurations. Leave blank to auto-detect.

commitlint.log.enabled

Whether to enable logging to the output panel.

commitlint.preferBundledLibraries

Whether to prefer using commitlint libraries bundled with the extension over locally or globally installed versions.