Awesome
vscode-commitlint
A VS Code extension that integrates commitlint into VS Code's commit editor.
Install from the Visual Studio Marketplace
Features
- Runs commitlint against your commit message as you write it
- Reports lint errors and warnings in the editor
- Highlights relevant parts of the commit based on the specific issue
- Auto detects commitlint configuration by default
- Supports all commitlint rules
- Adds autocomplete support to
package.json
and.commitlintrc.json
based on the configuration schema
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:
- When the built-in SCM input is empty, using the
git.useEditorAsCommitInput
setting - As the editor for
git
commands spawned in the integrated terminal, using thegit.terminalGitEditor
setting - As the default commit editor
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.