@vvanouytsel/commitlint-config
v1.0.1
Published
A shareable commitlint configuration that extends conventional config with custom rules
Maintainers
Readme
@vvanouytsel/commitlint-config
A shareable commitlint configuration that extends the conventional config with custom rules and additional commit types.
Features
- ✅ Extends
@commitlint/config-conventional - 🎯 Custom commit types:
wip,deps - 📏 Configurable length limits (subject max 100 chars, header max 100 chars)
- 🔧 Customizable rules for better team consistency
- 🎨 Includes prompt configuration for interactive commits
Installation
Install the package as a development dependency:
npm install --save-dev @vvanouytsel/commitlint-configYou'll also need to install commitlint if you haven't already:
npm install --save-dev @commitlint/cliUsage
Create a commitlint.config.js file in your project root:
module.exports = {
extends: ["@vvanouytsel/commitlint-config"],
};Or add it to your package.json:
{
"commitlint": {
"extends": ["@vvanouytsel/commitlint-config"]
}
}Custom Rules
This configuration extends the conventional config with the following customizations:
Additional Commit Types
wip: Work in progress commitsdeps: Dependency updates
Rule Overrides
- Subject case: Prevents sentence-case, start-case, pascal-case, and upper-case
- Subject length: Min 3 characters, max 100 characters
- Header length: Max 100 characters, min 10 characters
- Body: Leading blank line required, max 100 chars per line
- Footer: Leading blank line required, max 100 chars per line
- Scope: Lower-case, max 20 characters
- Empty body: Allowed (rule disabled)
Complete Commit Types
The following commit types are supported:
| Type | Description | Emoji |
| ---------- | ------------------------------------ | ----- |
| feat | A new feature | ✨ |
| fix | A bug fix | 🐛 |
| docs | Documentation only changes | 📚 |
| style | Code style changes (formatting, etc) | 💎 |
| refactor | Code refactoring | 📦 |
| perf | Performance improvements | 🚀 |
| test | Adding or updating tests | 🚨 |
| build | Build system or dependency changes | 🛠 |
| ci | CI configuration changes | ⚙️ |
| chore | Other changes | ♻️ |
| revert | Revert a previous commit | 🗑 |
| wip | Work in progress | 🚧 |
| deps | Dependency updates | ⬆️ |
Examples
Valid commit messages:
feat: add user authentication
fix(auth): resolve login redirect issue
docs: update API documentation
style: format code with prettier
refactor(utils): simplify validation logic
perf: optimize database queries
test: add unit tests for user service
build: update webpack configuration
ci: add GitHub Actions workflow
chore: update gitignore
revert: revert previous authentication changes
wip: implement user profile feature
deps: update lodash to version 4.17.21Invalid commit messages:
Fix bug # Missing type
feat:add feature # Missing space after colon
FEAT: add feature # Wrong case for type
feat: Add feature # Wrong case for subject
feat: # Empty subject
feat: a # Subject too shortGit Hooks Integration
To automatically validate commits, you can use husky:
npm install --save-dev huskyAdd to your package.json:
{
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}Customization
You can override any rules in your project's commitlint configuration:
module.exports = {
extends: ["@vvanouytsel/commitlint-config"],
rules: {
"subject-max-length": [2, "always", 80], // Override max length to 80
"type-enum": [2, "always", ["feat", "fix"]], // Only allow feat and fix
},
};Interactive Commits
This config includes prompt configuration for tools like @commitlint/prompt-cli or commitizen.
Install commitizen adapter:
npm install --save-dev @commitlint/prompt-cliThen use:
npx commitTesting
This package includes a comprehensive test suite to validate the configuration:
# Run the test suite (doesn't require git repository)
npm test
# Test against actual git commits (requires git repository with commits)
npm run test:gitThe test suite validates both valid and invalid commit messages according to the configuration rules.
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
