-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.mjs
More file actions
53 lines (52 loc) · 2.15 KB
/
Copy pathcommitlint.config.mjs
File metadata and controls
53 lines (52 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// commitlint configuration.
//
// Enforces Conventional-Commits shape so the cliff-driven CHANGELOG
// regen (scripts/regen-changelog.py) can categorise every commit
// deterministically. Project-level package.json is intentionally
// absent — the pre-commit hook (alessandrojcm/commitlint-pre-commit-hook)
// and the GitHub workflow (wagoid/commitlint-github-action) both
// auto-fetch the Node runtime they need.
//
// ESM (.mjs) is required: wagoid/commitlint-github-action rejects a
// `.js` configFile outright ("please use .mjs instead"), and commitlint's
// own config resolver discovers `commitlint.config.mjs` for the local
// pre-commit hook too — so a single ESM module serves both lanes.
//
// Tuning rationale:
// - type-enum: strict; the historical 5 'debug(ci):' commits stay
// in git but new ones must use 'ci:' or 'chore:' instead.
// - scope-enum: disabled. The repo carries ~130 historical scopes,
// and the long tail (page-name scopes like 'chrome', 'topbar')
// means a closed list would either reject legitimate new scopes
// or balloon to unreadable size. Type-discipline is the primary
// load-bearing rule; scope-shape is freeform.
// - subject-case: disabled — many historical subjects are sentence
// case (capitalised first word), the CHANGELOG renderer normalises
// anyway.
// - subject-max-length: 120 (loosened from default 100 because some
// legitimate refactor commits carry rc-range suffixes that push
// past 100).
// - header-max-length: 120 (matches subject).
//
// To install the commit-msg hook locally:
// uv run pre-commit install --hook-type commit-msg
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2, 'always',
['feat', 'fix', 'docs', 'refactor', 'test', 'chore',
'build', 'ci', 'perf', 'style', 'revert'],
],
'scope-enum': [0],
'scope-empty': [0],
'scope-case': [0],
'subject-case': [0],
'subject-empty': [2, 'never'],
'subject-min-length': [2, 'always', 5],
'subject-max-length': [2, 'always', 120],
'type-empty': [2, 'never'],
'header-max-length': [2, 'always', 120],
'body-leading-blank': [1, 'always'],
},
};