@lazyconfig/commitlint 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +196 -0
- package/base.json +24 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ruben-omh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# @lazyconfig/commitlint
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@lazyconfig/commitlint)
|
|
4
|
+
[](https://www.npmjs.com/package/@lazyconfig/commitlint)
|
|
5
|
+
[](https://conventionalcommits.org)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/sponsors/ruben-omh)
|
|
8
|
+
|
|
9
|
+
Shared Commitlint configuration that enforces consistent, readable commit messages following the [Conventional Commits](https://www.conventionalcommits.org/) specification.
|
|
10
|
+
|
|
11
|
+
Extends `@commitlint/config-conventional` with an opinionated set of rules to keep commit history clean, predictable, and tooling-friendly across all projects.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Based on Conventional Commits — compatible with changelogs, semantic versioning, and release tools
|
|
18
|
+
- Enforces 11 commit types covering the full development workflow
|
|
19
|
+
- Hard limits on header, scope, and subject length to keep history scannable
|
|
20
|
+
- Warnings for missing scope and blank lines before body/footer
|
|
21
|
+
- Fully overridable — extend or tighten any rule locally
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# pnpm
|
|
29
|
+
pnpm add -D @lazyconfig/commitlint @commitlint/cli @commitlint/config-conventional
|
|
30
|
+
|
|
31
|
+
# npm
|
|
32
|
+
npm install --save-dev @lazyconfig/commitlint @commitlint/cli @commitlint/config-conventional
|
|
33
|
+
|
|
34
|
+
# yarn
|
|
35
|
+
yarn add --dev @lazyconfig/commitlint @commitlint/cli @commitlint/config-conventional
|
|
36
|
+
|
|
37
|
+
# bun
|
|
38
|
+
bun add --dev @lazyconfig/commitlint @commitlint/cli @commitlint/config-conventional
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
Create a `commitlint.config.cjs` in your project root:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// commitlint.config.cjs
|
|
49
|
+
module.exports = {
|
|
50
|
+
extends: ["@lazyconfig/commitlint"],
|
|
51
|
+
};
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or in ESM (`.commitlintrc.mjs`):
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
export default {
|
|
58
|
+
extends: ["@lazyconfig/commitlint"],
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> Use `.cjs` for the CommonJS format — if your project has `"type": "module"` in `package.json`, a plain `.js` config file will be treated as ESM and `module.exports` will fail.
|
|
63
|
+
|
|
64
|
+
That's it — commitlint will now validate every commit message against lazyconfig's rules.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Commit Message Format
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
<type>(<scope>): <subject>
|
|
72
|
+
|
|
73
|
+
[optional body]
|
|
74
|
+
|
|
75
|
+
[optional footer(s)]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Examples
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
feat(auth): add OAuth2 login support
|
|
82
|
+
fix(api): handle empty response in fetchUser
|
|
83
|
+
docs(readme): update installation instructions
|
|
84
|
+
chore(deps): upgrade typescript to v5.4
|
|
85
|
+
refactor(core): extract validation logic into helpers
|
|
86
|
+
test(utils): add edge-case coverage for parseDate
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Allowed Types
|
|
92
|
+
|
|
93
|
+
| Type | Description |
|
|
94
|
+
| ---------- | ----------------------------------------------- |
|
|
95
|
+
| `feat` | A new feature |
|
|
96
|
+
| `fix` | A bug fix |
|
|
97
|
+
| `docs` | Documentation changes only |
|
|
98
|
+
| `style` | Formatting changes with no effect on logic |
|
|
99
|
+
| `refactor` | Code change that is neither a fix nor a feature |
|
|
100
|
+
| `perf` | Performance improvements |
|
|
101
|
+
| `test` | Adding or updating tests |
|
|
102
|
+
| `build` | Build system or external dependency changes |
|
|
103
|
+
| `ci` | CI configuration changes |
|
|
104
|
+
| `chore` | Maintenance and tooling tasks |
|
|
105
|
+
| `revert` | Reverts a previous commit |
|
|
106
|
+
|
|
107
|
+
Commits using any other type will be **rejected with an error**.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Enforced Rules
|
|
112
|
+
|
|
113
|
+
| Part | Rule | Severity |
|
|
114
|
+
| ------- | -------------------------------- | -------- |
|
|
115
|
+
| Type | Must not be empty | Error |
|
|
116
|
+
| Type | Must be lowercase | Error |
|
|
117
|
+
| Type | Must be one of the allowed types | Error |
|
|
118
|
+
| Scope | Must be lowercase | Error |
|
|
119
|
+
| Scope | Must not be empty | Warning |
|
|
120
|
+
| Scope | Maximum 25 characters | Error |
|
|
121
|
+
| Subject | Must not be empty | Error |
|
|
122
|
+
| Subject | Maximum 72 characters | Error |
|
|
123
|
+
| Header | Maximum 100 characters | Error |
|
|
124
|
+
| Body | Must be preceded by a blank line | Warning |
|
|
125
|
+
| Footer | Must be preceded by a blank line | Warning |
|
|
126
|
+
|
|
127
|
+
> **Error** — commit is rejected. **Warning** — commit is accepted but a message is printed.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Git Hooks Integration
|
|
132
|
+
|
|
133
|
+
Pair with [Husky](https://typicode.github.io/husky/) to validate commit messages automatically before they are recorded:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# pnpm
|
|
137
|
+
pnpm add -D husky
|
|
138
|
+
pnpm exec husky init
|
|
139
|
+
|
|
140
|
+
# npm
|
|
141
|
+
npm install --save-dev husky
|
|
142
|
+
npx husky init
|
|
143
|
+
|
|
144
|
+
# yarn
|
|
145
|
+
yarn add --dev husky
|
|
146
|
+
yarn husky init
|
|
147
|
+
|
|
148
|
+
# bun
|
|
149
|
+
bun add --dev husky
|
|
150
|
+
bunx husky init
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Then add the `commit-msg` hook:
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
# .husky/commit-msg
|
|
157
|
+
commitlint --edit $1
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
> Husky v9 adds `node_modules/.bin` to `PATH` automatically, so `commitlint` can be called directly without a package manager prefix.
|
|
161
|
+
|
|
162
|
+
Once set up, any commit with a non-conforming message will be blocked immediately.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Extending or Overriding Rules
|
|
167
|
+
|
|
168
|
+
Override any rule locally by adding a `rules` block:
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
// commitlint.config.js
|
|
172
|
+
module.exports = {
|
|
173
|
+
extends: ["@lazyconfig/commitlint"],
|
|
174
|
+
rules: {
|
|
175
|
+
// Make scope mandatory (error instead of warning)
|
|
176
|
+
"scope-empty": [2, "never"],
|
|
177
|
+
|
|
178
|
+
// Relax subject length if needed
|
|
179
|
+
"subject-max-length": [2, "always", 100],
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Related Links
|
|
187
|
+
|
|
188
|
+
- [Conventional Commits](https://www.conventionalcommits.org/)
|
|
189
|
+
- [Commitlint Documentation](https://commitlint.js.org/)
|
|
190
|
+
- [Husky](https://typicode.github.io/husky/)
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT
|
package/base.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@commitlint/config-conventional"],
|
|
3
|
+
"rules": {
|
|
4
|
+
"type-enum": [
|
|
5
|
+
2,
|
|
6
|
+
"always",
|
|
7
|
+
["ci", "chore", "docs", "feat", "fix", "refactor", "revert", "style", "perf", "test", "build"]
|
|
8
|
+
],
|
|
9
|
+
"type-empty": [2, "never"],
|
|
10
|
+
"type-case": [2, "always", ["lower-case"]],
|
|
11
|
+
"scope-case": [2, "always", "lower-case"],
|
|
12
|
+
"scope-empty": [1, "never"],
|
|
13
|
+
"scope-max-length": [2, "always", 25],
|
|
14
|
+
"header-max-length": [2, "always", 100],
|
|
15
|
+
"subject-max-length": [2, "always", 72],
|
|
16
|
+
"subject-empty": [2, "never"],
|
|
17
|
+
"subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
|
|
18
|
+
"subject-full-stop": [2, "never", "."],
|
|
19
|
+
"body-leading-blank": [1, "always"],
|
|
20
|
+
"body-min-length": [2, "always", 2],
|
|
21
|
+
"footer-leading-blank": [1, "always"]
|
|
22
|
+
},
|
|
23
|
+
"helpUrl": "https://github.com/conventional-changelog/commitlint/#what-is-commitlint"
|
|
24
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lazyconfig/commitlint",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Shared, production-ready Commitlint configuration for enforcing consistent conventional commit messages.",
|
|
5
|
+
"files": [
|
|
6
|
+
"base.json",
|
|
7
|
+
"package.json",
|
|
8
|
+
"README.md",
|
|
9
|
+
"LICENSE"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./base.json",
|
|
13
|
+
"./base": "./base.json",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"commitlint",
|
|
18
|
+
"config",
|
|
19
|
+
"commit",
|
|
20
|
+
"conventional",
|
|
21
|
+
"commitlint-config",
|
|
22
|
+
"lazyconfig"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "echo \"no build required\""
|
|
26
|
+
},
|
|
27
|
+
"packageManager": "pnpm@11.5.2",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.0.0",
|
|
30
|
+
"pnpm": ">=10.0.0"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/ruben-omh/lazyconfig/tree/main/packages/commitlint#readme",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/ruben-omh/lazyconfig/issues"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/ruben-omh/lazyconfig",
|
|
42
|
+
"directory": "packages/commitlint"
|
|
43
|
+
},
|
|
44
|
+
"author": "ruben-omh",
|
|
45
|
+
"license": "MIT"
|
|
46
|
+
}
|