Repository navigation
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
96 lines (96 loc) · 3.61 KB
/
Copy pathcommitlint.config.js
File metadata and controls
96 lines (96 loc) · 3.61 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/**
* Commitlint config — the commit-message gate for the repo.
* Merges to `main` are squash merges: release-please parses the squashed
* commit header (the PR title), and its conventional-commit parser is NOT
* configurable — the header must START with the bare type. A leading ticket
* tag (`[NO-ISSUE] fix: …`) is unparseable there and silently produces no
* release, so that form is rejected here; the ticket tag lives in the
* subject instead, right after the colon — and only when a real ticket
* exists. No ticket → no tag (never write "[NO-ISSUE]" — dead characters).
*
* Accepted forms:
* fix(theme): [ENG-1234] move vue-tsc to devDependencies
* feat(webkit)!: [ENG-999] drop tone prop
* fix(webkit): commit message ← no ticket → no tag
* fix: commit message
*
* Rejected:
* [NO-ISSUE] fix(webkit): commit message ← pre-2026-07 form — invisible to release-please
* fix(webkit): [NO-ISSUE] commit message ← no ticket → omit the tag entirely
*
* Breaking changes (produce a major release):
* feat(webkit)!: drop tone prop ← `!` after type/scope
* feat(webkit): add x\n\nBREAKING CHANGE: drops y ← footer form
*
* Type → release (stock release-please; not configurable per type):
* feat → minor
* fix → patch
* chore | docs | style | refactor |
* perf | test | ci | revert → no release (allowed for hygiene, no version bump)
* any-type with `!` or BREAKING: → major
* Contract: .claude/rules/release-types.md
*/
export default {
parserPreset: {
parserOpts: {
headerPattern: /^(\w+)(?:\(([\w-]+)\))?!?:\s(.*)$/,
headerCorrespondence: ['type', 'scope', 'subject']
}
},
plugins: [
{
rules: {
// Migration guard: the old `[TICKET] type: …` header parses as no
// type at all, so without this rule the only feedback would be a
// cryptic "type may not be empty". Point at the new form instead.
'header-no-leading-ticket': (parsed) => {
const header = parsed.header ?? ''
return [
!/^\[[^\]]*\]/.test(header),
'the ticket tag moved: write "type(scope): [TICKET] subject" — a leading "[TICKET] type: …" header is invisible to release-please and releases nothing'
]
},
// When the subject opens with a bracket tag, it must be a real,
// well-formed ticket ([ABC-123]) followed by a space and the subject
// text. No ticket → no tag ("[NO-ISSUE]" is dead characters).
'subject-ticket-tag': (parsed) => {
const subject = parsed.subject ?? ''
if (!subject.startsWith('[')) return [true]
if (/^\[NO-ISSUE\]/i.test(subject)) {
return [false, 'no tracking ticket → omit the tag entirely (do not write "[NO-ISSUE]")']
}
return [
/^\[[A-Z]+-\d+\] \S/.test(subject),
'subject ticket tag must be "[ABC-123]" followed by a space and the subject text'
]
}
}
}
],
rules: {
'header-no-leading-ticket': [2, 'always'],
'type-empty': [2, 'never'],
'type-case': [2, 'always', 'lower-case'],
'type-enum': [
2,
'always',
[
'feat',
'fix',
'chore',
'docs',
'style',
'refactor',
'perf',
'test',
'ci',
'revert'
]
],
'scope-case': [2, 'always', 'lower-case'],
'subject-empty': [2, 'never'],
'subject-case': [0],
'subject-ticket-tag': [2, 'always'],
'header-max-length': [2, 'always', 100]
}
}