-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitlint.config.js
94 lines (92 loc) · 3.34 KB
/
commitlint.config.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
/*!
* Original code by Patrick Fu
* Copyright (c) 2021 Patrick Fu, see LICENSE.md for details
*
* Credits to the Gitmoji Commitlint Guide author:
* https://github.com/patrick-fu/gitmoji_commitlint_guide
*/
/*!
* Original code by Carlos Cuesta
* MIT Licensed, Copyright (c) 2016-2022 Carlos Cuesta, see LICENSE.md for details
*
* Credits to the Gitmoji team:
* https://github.com/carloscuesta/gitmoji/blob/master/src/data/gitmojis.json
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
const gitmojis = require('./gitmojis.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const types = require('./types.json');
/** @type {import('cz-git').UserConfig} */
module.exports = {
extends: ['@commitlint/config-conventional'],
parserPreset: {
parserOpts: {
// We change the parser regex pattern to match emoji UTF-8 character
// The "[\u23ea-\ufe0f]{1,2}" means that some emojis are in two bytes but not one
// So this pattern matches string like "🐛 Fix a bug"
headerPattern: /^([\u23ea-\ufe0f]{1,2})(?:\(([\w$.\-* ]*)\))? (.*)$/,
headerCorrespondence: ['type', 'scope', 'subject'],
},
},
rules: {
'type-enum': [2, 'always', gitmojis],
'type-case': [0, 'always', 'lower-case'],
'subject-full-stop': [2, 'never', '.'],
'subject-case': [0, 'always', 'sentence-case'],
'subject-min-length': [2, 'always', 15],
'subject-max-length': [2, 'always', 100],
'header-max-length': [2, 'always', 100],
'body-max-line-length': [2, 'always', 200],
'type-empty': [0],
'subject-empty': [0],
},
prompt: {
alias: { fd: 'docs: fix typos' },
formatMessageCB: ({ emoji, scope, subject }) => {
return scope ? `${emoji} (${scope}): ${subject}` : `${emoji} ${subject}`;
},
messages: {
type: "Select the type of change that you're committing:",
scope: 'Denote the SCOPE of this change (optional):',
customScope: 'Denote the SCOPE of this change:',
subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking:
'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
footerPrefixsSelect:
'Select the ISSUES type of changeList by this change (optional):',
customFooterPrefixs: 'Input ISSUES prefix:',
footer: 'List any ISSUES by this change. E.g.: #31, #34:\n',
confirmCommit: 'Are you sure you want to proceed with the commit above?',
},
types,
useEmoji: true,
emojiAlign: 'center',
themeColorCode: '',
scopes: [],
allowCustomScopes: true,
allowEmptyScopes: true,
customScopesAlign: 'bottom',
customScopesAlias: 'custom',
emptyScopesAlias: 'empty',
upperCaseSubject: false,
markBreakingChangeMode: false,
allowBreakingChanges: ['feat', 'fix'],
breaklineChar: '|',
skipQuestions: [],
issuePrefixs: [
{ value: 'closed', name: 'closed: ISSUES has been processed' },
],
customIssuePrefixsAlign: 'top',
emptyIssuePrefixsAlias: 'skip',
customIssuePrefixsAlias: 'custom',
allowCustomIssuePrefixs: true,
allowEmptyIssuePrefixs: true,
confirmColorize: true,
scopeOverrides: undefined,
defaultBody: '',
defaultIssues: '',
defaultScope: '',
defaultSubject: '',
},
};