0.1.3 • Published 7 months ago
@benhigham/commitlint-config v0.1.3
@benhigham/commitlint-config
My personal commitlint configuration based on the Conventional Commits standard.
Features
- Based on
@commitlint/config-conventional - Provides consistent, structured commit messages
- Integrates with Atom-style changelogs
- Pre-configured formatting rules
Installation
# npm
npm install --save-dev @benhigham/commitlint-config
# yarn
yarn add --dev @benhigham/commitlint-config
# pnpm
pnpm add --save-dev @benhigham/commitlint-configUsage
Use in commitlint.config.js:
/** @type {import('@commitlint/types').UserConfig} */
const config = {
extends: ['@benhigham/commitlint-config'],
// your overrides here
};
export default config;With Git Hooks
For the best experience, use with lefthook or husky to enforce commit message formatting:
Example with lefthook
# lefthook.yml
commit-msg:
commands:
lint-commit:
run: pnpm exec commitlint --edit {1}Example with husky
# Install husky
npm install --save-dev husky
# Set up the commit-msg hook
npx husky add .husky/commit-msg 'npx commitlint --edit $1'Commit Message Format
This configuration enforces the Conventional Commits format:
<type>[(optional scope)]: <description>
[optional body]
[optional footer(s)]Types
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the coderefactor: A code change that neither fixes a bug nor adds a featureperf: A code change that improves performancetest: Adding missing tests or correcting existing testsbuild: Changes that affect the build system or external dependenciesci: Changes to CI configuration files and scriptschore: Other changes that don't modify src or test filesrevert: Reverts a previous commit
Requirements
- Node.js 18.20.x or higher
- commitlint 19.x
License
This project is licensed under the MIT License.