Commitlint configuration with emoji support and custom nx scope resolution.
npm install collide-commitlintCommitlint configuration with emoji support and NX workspace scope resolution.
- ๐จ Emoji prefixes in commit messages
- ๐ Automatic NX workspace scope validation
- ๐ Based on conventional commits
- ๐ฌ Interactive commit prompts with Commitizen
``bashnpm
npm install --save-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:`typescript
import { commitlint } from 'collide-commitlint';export default commitlint();
`๐ Usage
$3
`typescript
import { commitlint } from 'collide-commitlint';export default commitlint({
// Your custom commitlint rules
rules: {
'subject-max-length': [2, 'always', 100],
},
});
`$3
By default, emojis are enabled. Commits will look like:
`text
โจ feat(auth): add login functionality
๐ fix(api): handle null responses
๐ docs(readme): update installation guide
`Disable emojis:
`typescript
export default commitlint({
emoji: {
enabled: false,
},
});
`Custom emoji mappings:
`typescript
export default commitlint({
emoji: {
customEmojis: {
feat: '๐',
fix: '๐ฅ',
docs: '๐',
},
},
});
`$3
Automatically validates commit scopes against your NX project names:
`typescript
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:`json
{
"path": "@commitlint/cz-commitlint"
}
`Then use Commitizen for interactive commit prompts:
`bash
npx cz
`The prompts will include emoji selection and scope validation based on your commitlint configuration.
Advanced API
$3
`typescript
import { createEmojiParser, createEmojiEnum } from 'collide-commitlint';const parser = await createEmojiParser({
customEmojis: { feat: '๐' },
});
`$3
`typescript
import { createNxScopesRule } from 'collide-commitlint';const scopeRule = createNxScopesRule({
customScopes: ['workspace'],
trimProjectPrefix: true,
});
`TypeScript Support
Full TypeScript support with exported types:
`typescript
import type {
ICommitlintConfigOptions,
IEmojiConfig,
INxScopesConfig,
INxProjectFilter,
TEmojiType,
} from 'collide-commitlint';
``MIT