@tempel/commitlint
v1.1.0
Published
Commitlint configuration for Tempel
Readme
@tempel/commitlint
A zero-configuration commitlint setup that extends @commitlint/config-conventional with a flexible configuration factory. This package provides an easy way to enforce Conventional Commits in your JavaScript and TypeScript projects.
Features
- Zero Configuration: Works out of the box with sensible defaults
- Flexible Factory: Configuration function accepts custom options
- Conventional Commits: Built on
@commitlint/config-conventional - Dual Module Support: ESM and CommonJS compatible
Installation
npm install --save-dev @tempel/commitlintUsage
Basic Usage
// commitlint.config.mjs
import commitlintConfig from '@tempel/commitlint';
export default commitlintConfig();With Custom Options
// commitlint.config.mjs
import commitlintConfig from '@tempel/commitlint';
export default commitlintConfig({
rules: {
'header-max-length': [2, 'always', 72]
},
ignores: [
(commit) => commit.includes('[skip ci]')
]
});CommonJS
// commitlint.config.cjs
const commitlintConfig = require('@tempel/commitlint');
module.exports = commitlintConfig();Configuration
The configuration factory merges your options with the base @commitlint/config-conventional configuration. Pass requireIssueId: true to require a GitHub issue reference in the commit header:
export default commitlintConfig({
requireIssueId: true,
});This accepts headers such as feat(#51): add Jest support and rejects headers without a #123 issue scope. The option defaults to false in the reusable factory.
For detailed rule configuration and usage, see the commitlint documentation.
Git Hooks Setup
Install with Husky for automatic commit message validation:
npm install --save-dev husky
mise exec -- pnpm --filter ./packages/commitlint exec -- commitlint --config "$PWD/commitlint.config.mjs" --edit "$1"
chmod +x .husky/commit-msgTesting
The package includes comprehensive tests validating configuration factory behavior:
mise run testDocumentation
License
MIT © Dragos Cirjan
