-
Notifications
You must be signed in to change notification settings - Fork 2
/
.commitlintrc.js
372 lines (369 loc) · 9.86 KB
/
.commitlintrc.js
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
/*
* Copyright (C) 2024 Alexandre Nicolaie ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ----------------------------------------------------------------------------
*/
/**
* List of allowed commit type, based on the Gitmoji convention.
*
* @see {@link https://gitmoji.dev/}
*/
const types = [
{
value: ":adhesive_bandage:",
emoji: "🩹",
name: ":adhesive_bandage: 🩹 Simple fix for a non-critical issue.",
},
{
value: ":alembic:",
emoji: "⚗️",
name: ":alembic: ⚗️ Perform experiments.",
},
{
value: ":alien:",
emoji: "👽️",
name: ":alien: 👽️ Update code due to external API changes.",
},
{
value: ":ambulance:",
emoji: "🚑️",
name: ":ambulance: 🚑️ Critical hotfix.",
},
{
value: ":arrow_down:",
emoji: "⬇️",
name: ":arrow_down: ⬇️ Downgrade dependencies.",
},
{
value: ":arrow_up:",
emoji: "⬆️",
name: ":arrow_up: ⬆️ Upgrade dependencies.",
},
{
value: ":art:",
emoji: "🎨",
name: ":art: 🎨 Improve structure / format of the code.",
},
{
value: ":bento:",
emoji: "🍱",
name: ":bento: 🍱 Add or update assets.",
},
{
value: ":bookmark:",
emoji: "🔖",
name: ":bookmark: 🔖 Release / Version tags.",
},
{
value: ":boom:",
emoji: "💥",
name: ":boom: 💥 Introduce breaking changes.",
},
{
value: ":bricks:",
emoji: "🧱",
name: ":bricks: 🧱 Infrastructure related changes.",
},
{
value: ":bug:",
emoji: "🐛",
name: ":bug: 🐛 Fix a bug.",
},
{
value: ":building_construction:",
emoji: "🏗️",
name: ":building_construction: 🏗️ Make architectural changes.",
},
{
value: ":bulb:",
emoji: "💡",
name: ":bulb: 💡 Add or update comments in source code.",
},
{
value: ":closed_lock_with_key:",
emoji: "🔐",
name: ":closed_lock_with_key: 🔐 Add or update secrets.",
},
{
value: ":coffin:",
emoji: "⚰️",
name: ":coffin: ⚰️ Remove dead code.",
},
{
value: ":construction_worker:",
emoji: "👷",
name: ":construction_worker: 👷 Add or update CI build system.",
},
{
value: ":fire:",
emoji: "🔥",
name: ":fire: 🔥 Remove code or files.",
},
{
value: ":green_heart:",
emoji: "💚",
name: ":green_heart: 💚 Fix CI Build.",
},
{
value: ":hammer:",
emoji: "🔨",
name: ":hammer: 🔨 Add or update development scripts.",
},
{
value: ":heavy_minus_sign:",
emoji: "➖",
name: ":heavy_minus_sign: ➖ Remove a dependency.",
},
{
value: ":heavy_plus_sign:",
emoji: "➕",
name: ":heavy_plus_sign: ➕ Add a dependency.",
},
{
value: ":label:",
emoji: "🏷️",
name: ":label: 🏷️ Add or update types.",
},
{
value: ":lipstick:",
emoji: "💄",
name: ":lipstick: 💄 Add or update the UI and style files.",
},
{
value: ":lock:",
emoji: "🔒️",
name: ":lock: 🔒️ Fix security or privacy issues.",
},
{
value: ":memo:",
emoji: "📝",
name: ":memo: 📝 Add or update documentation.",
},
{
value: ":package:",
emoji: "📦️",
name: ":package: 📦️ Add or update compiled files or packages.",
},
{
value: ":page_facing_up:",
emoji: "📄",
name: ":page_facing_up: 📄 Add or update license.",
},
{
value: ":passport_control:",
emoji: "🛂",
name: ":passport_control: 🛂 Work on code related to authorization roles and permissions.",
},
{
value: ":pencil2:",
emoji: "✏️",
name: ":pencil2: ✏️ Fix typos.",
},
{
value: ":pushpin:",
emoji: "📌",
name: ":pushpin: 📌 Pin dependencies to specific versions.",
},
{
value: ":recycle:",
emoji: "♻️",
name: ":recycle: ♻️ Refactor code.",
},
{
value: ":rewind:",
emoji: "⏪️",
name: ":rewind: ⏪️ Revert changes.",
},
{
value: ":rocket:",
emoji: "🚀",
name: ":rocket: 🚀 Deploy stuff.",
},
{
value: ":rotating_light:",
emoji: "🚨",
name: ":rotating_light: 🚨 Fix compiler / linter warnings.",
},
{
value: ":safety_vest:",
emoji: "🦺",
name: ":safety_vest: 🦺 Add or update code related to validation.",
},
{
value: ":see_no_evil:",
emoji: "🙈",
name: ":see_no_evil: 🙈 Add or update a .gitignore file.",
},
{
value: ":sparkles:",
emoji: "✨",
name: ":sparkles: ✨ Introduce new features.",
},
{
value: ":stethoscope:",
emoji: "🩺",
name: ":stethoscope: 🩺 Add or update healthcheck.",
},
{
value: ":tada:",
emoji: "🎉",
name: ":tada: 🎉 Begin a project.",
},
{
value: ":technologist:",
emoji: "💻",
name: ":technologist: 💻 Improve developer experience.",
},
{
value: ":test_tube:",
emoji: "🧪",
name: ":test_tube: 🧪 Add a failing test.",
},
{
value: ":truck:",
emoji: "🚚",
name: ":truck: 🚚 Move or rename resources (e.g.: files paths routes).",
},
{
value: ":twisted_rightwards_arrows:",
emoji: "🔀",
name: ":twisted_rightwards_arrows: 🔀 Merge branches.",
},
{
value: ":wastebasket:",
emoji: "🗑️",
name: ":wastebasket: 🗑️ Deprecate code that needs to be cleaned up.",
},
{
value: ":white_check_mark:",
emoji: "✅",
name: ":white_check_mark: ✅ Add update or pass tests.",
},
{
value: ":wrench:",
emoji: "🔧",
name: ":wrench: 🔧 Add or update configuration files.",
},
{
value: ":zap:",
emoji: "⚡️",
name: ":zap: ⚡️ Improve performance.",
},
];
/**
* List of allowed commit scopes.
*/
const scopes = [
{
name: "catalog:ansible - Anything related to the Ansible role catalog",
value: "catalog:ansible",
},
{
name: "catalog:crossplane - Anything related to the Crossplane resource catalog",
value: "catalog:crossplane",
},
{
name: "catalog:flakes - Anything related to the Nix flakes catalog",
value: "catalog:flakes",
},
{
name: "catalog:kairos-bundle - Anything related to the Kairos bundle catalog",
value: "catalog:kairos-bundle",
},
{
name: "project:chezmoi.sh - Anything related to the chezmoi.sh project",
value: "project:chezmoi.sh",
},
{
name: "project:hass - Anything related to the Home Assistant project",
value: "project:hass",
},
{
name: "project:nex·rpi - Anything related to the Nex·RPI project (chezmoi.sh)",
value: "project:nex·rpi",
},
{
name: "gh - Anything else",
value: "gh",
},
];
/** @type {import('cz-git').UserConfig} */
module.exports = {
rules: {
"body-full-stop": [0, "always", "."],
"body-leading-blank": [0, "always"],
"body-empty": [0, "always"],
"body-max-length": [2, "always", "Infinity"],
"body-max-line-length": [2, "always", 80],
"body-min-length": [2, "always", 0],
"body-case": [2, "always", "sentence-case"],
"footer-leading-blank": [2, "always"],
"footer-empty": [2, "always"],
"footer-max-length": [2, "always", "Infinity"],
"footer-max-line-length": [2, "always", 80],
"footer-min-length": [2, "always", 0],
"header-case": [2, "always", "sentence-case"],
"header-full-stop": [2, "never", "."],
"header-max-length": [2, "always", 100],
"header-min-length": [2, "always", 0],
"header-trim": [2, "always"],
"references-empty": [0, "never"],
"scope-enum": [2, "always", scopes.map((scope) => scope.value)],
"scope-case": [2, "always", "lower-case"],
"scope-empty": [2, "never"],
"scope-max-length": [2, "always", "Infinity"],
"scope-min-length": [2, "always", 0],
"subject-case": [2, "always", "sentence-case"],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"subject-max-length": [2, "always", 100],
"subject-min-length": [2, "always", 0],
"subject-exclamation-mark": [0, "never"],
"type-enum": [2, "always", types.map((type) => type.value)],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"type-max-length": [2, "always", "Infinity"],
"type-min-length": [2, "always", 0],
"signed-off-by": [2, "always", "Signed-off-by: "],
},
parserPreset: {
parserOpts: {
headerPattern:
"^(?<type>.+?)\\((?<scope>.+?)\\)!?\\:\\s(?<subject>(?:(?!#).)*(?:(?!\\s).))(?:\\s\\(?(?<references>#\\d*)\\)?)?$",
breakingHeaderPattern:
"^(?<type>.+?)\\((?<scope>.+?)\\)!\\:\\s(?<subject>(?:(?!#).)*(?:(?!\\s).))(?:\\s\\(?(?<references>#\\d*)\\)?)?$",
headerCorrespondence: ["type", "scope", "subject", "references"],
},
},
prompt: {
allowBreakingChanges: [
":boom:",
":fire:",
":coffin:",
":building_construction:",
":alien:",
],
allowCustomScopes: false,
allowEmptyScopes: false,
enableMultipleScopes: true,
scopes: scopes,
scopeEnumSeparator: ",",
types: types,
typesSearchValue: false,
skipQuestions: ["body", "footerPrefix", "footer"],
upperCaseSubject: true,
useCommitSignGPG: true,
useEmoji: false,
},
};