collide-commitlint
v0.1.1
Published
Commitlint configuration with emoji support and custom nx scope resolution.
Downloads
6
Maintainers
Readme
⚫ collide-commitlint
Commitlint configuration with emoji support and NX workspace scope resolution.
✨ Features
- 🎨 Emoji prefixes in commit messages
- 🔍 Automatic NX workspace scope validation
- 📋 Based on conventional commits
- 💬 Interactive commit prompts with Commitizen
📦 Installation
# npm
npm install --save-dev collide-commitlint
# yarn
yarn add --dev collide-commitlint
# pnpm
pnpm add --save-dev collide-commitlint
# bun
bun add --dev collide-commitlint💡 Note: Install as a dev dependency since commitlint is a development tool used for validating commit messages during development and in CI/CD pipelines.
🚀 Quick Start
Create commitlint.config.ts in your project root:
import { commitlint } from 'collide-commitlint';
export default commitlint();📖 Usage
Basic Configuration
import { commitlint } from 'collide-commitlint';
export default commitlint({
// Your custom commitlint rules
rules: {
'subject-max-length': [2, 'always', 100],
},
});With Emoji Support
By default, emojis are enabled. Commits will look like:
✨ feat(auth): add login functionality
🐛 fix(api): handle null responses
📚 docs(readme): update installation guideDisable emojis:
export default commitlint({
emoji: {
enabled: false,
},
});Custom emoji mappings:
export default commitlint({
emoji: {
customEmojis: {
feat: '🎉',
fix: '🔥',
docs: '📝',
},
},
});NX Workspace Integration
Automatically validates commit scopes against your NX project names:
export default commitlint({
nxScopes: {
// Add custom scopes beyond NX projects
customScopes: ['workspace', 'deps'],
// Filter which NX projects are valid scopes
filter: project => {
return project.projectType === 'library';
},
// Trim scoped package names
// "@scope/my-package" → "my-package"
trimProjectPrefix: true,
},
});Default Emojis
| Type | Emoji | Description | | -------- | ----- | ------------------------ | | feat | ✨ | New feature | | fix | 🐛 | Bug fix | | docs | 📚 | Documentation | | style | 💎 | Code style changes | | refactor | ♻️ | Code refactoring | | perf | 🚀 | Performance improvements | | test | 🧪 | Tests | | build | 🏗️ | Build system | | ci | 👷 | CI configuration | | chore | 🔧 | Maintenance tasks | | revert | ⏪ | Revert previous commit |
Interactive Commits
Create a .czrc file in your project root:
{
"path": "@commitlint/cz-commitlint"
}Then use Commitizen for interactive commit prompts:
npx czThe prompts will include emoji selection and scope validation based on your commitlint configuration.
Advanced API
Export Custom Parser
import { createEmojiParser, createEmojiEnum } from 'collide-commitlint';
const parser = await createEmojiParser({
customEmojis: { feat: '🎉' },
});Export NX Scopes Rule
import { createNxScopesRule } from 'collide-commitlint';
const scopeRule = createNxScopesRule({
customScopes: ['workspace'],
trimProjectPrefix: true,
});TypeScript Support
Full TypeScript support with exported types:
import type {
ICommitlintConfigOptions,
IEmojiConfig,
INxScopesConfig,
INxProjectFilter,
TEmojiType,
} from 'collide-commitlint';License
MIT
