forked from cuhacking/2025
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitlint.config.ts
174 lines (169 loc) Β· 6.15 KB
/
commitlint.config.ts
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
import type { UserConfig } from '@commitlint/types'
import { RuleConfigSeverity } from '@commitlint/types'
const Configuration: UserConfig = {
// parserPreset: 'conventional-changelog-conventionalcommits',
// Extend conventional commit configurations
// https://www.conventionalcommits.org/en/v1.0.0/
// extends: ['@commitlint/config-conventional'],
rules: {
// -------------- TYPE ----------------
// Ensure type is one of the specified values
'type-enum': [
RuleConfigSeverity.Error,
'always', // Always enforce this rule
[
'test', // Adding or updating tests
'chore', // Other changes that don't modify src or test files
'docs', // Documentation changes
'refactor', // Code refactoring without changing functionality
'fix', // Bug fixes
'feat', // New features
'build', // Build-related changes (e.g., compile, package)
'ci', // Continuous Integration changes
'style', // Code style changes (formatting, white-space, etc.)
'perf', // Performance improvements
'revert', // Revert previous commits, only for emergencies
'hotfix', // For time-sensitive, emergency fixes
],
],
'type-case': [RuleConfigSeverity.Error, 'always', 'lower-case'],
'type-empty': [RuleConfigSeverity.Error, 'never'],
// -------------- SCOPE ----------------
'scope-case': [2, 'always', 'lower-case'], // Ensures scope is in lower case
'scope-enum': [1, 'always', [
'ui',
'api',
'config',
'docs',
'docs-e2e',
'web',
'web-e2e',
'portal',
'portal-e2e',
'tools',
]],
// 'scope-empty': [2, 'never'], // Scope should always be provided
// -------------- SUBJECT ----------------
// "subject-case": [RuleConfigSeverity.Error, "always", "sentence-case"],
'subject-empty': [RuleConfigSeverity.Error, 'never'],
// -------------- HEADER ----------------
// Ensure the header does not exceed 72 characters
// "header-max-length": [RuleConfigSeverity.Error, "always", 72],
},
helpUrl:
'https://main.dzzy1fby58ukt.amplifyapp.com/docs/contribution-guidelines/conventional-commits',
prompt: {
settings: {
enableMultipleScopes: true,
scopeEnumSeparator: '/',
},
messages: {
skip: ':skip',
max: 'upper %d chars',
min: '%d chars at least',
emptyWarning: 'can not be empty',
upperLimitWarning: 'over limit',
lowerLimitWarning: 'below limit',
},
// NOTE: Emojis are currently not activated in the commitlint configuration. To activate them, you can install the commitlint-emoji package and add it to the plugins array.
questions: {
type: {
description: 'Select the type of change that you\'re committing:',
enum: {
test: {
description: 'Adding missing tests or correcting existing tests',
title: 'Tests',
emoji: 'π¨',
},
chore: {
description: 'Other changes that don\'t modify src or test files, such as installing packages, updating config files, etc.',
title: 'Chores',
emoji: 'β»οΈ',
},
// TODO: Enable custom scope for docs page if type is docs
docs: {
description: 'Adding missing docs or correcting existing docs (use feat if adding a feature to docs site)',
title: 'Documentation',
emoji: 'π',
},
refactor: {
description: 'A code change that neither fixes a bug nor adds a feature',
title: 'Code Refactoring',
emoji: 'π¦',
},
fix: {
description: 'A bug fix',
title: 'Bug Fixes',
emoji: 'π',
},
feat: {
description: 'A new feature, along with tests and docs',
title: 'Features',
emoji: 'β¨',
},
build: {
description: 'Changes that affect the build system or external dependencies',
title: 'Builds',
emoji: 'π ',
},
ci: {
description: 'Changes to CI configuration files and scripts',
title: 'Continuous Integrations',
emoji: 'βοΈ',
},
style: {
description: 'Linting or formatting changes that do not affect the meaning of the code (white-space, semi-colons, parentheses, etc)',
title: 'Styles',
emoji: 'π',
},
perf: {
description: 'A code change that improves performance',
title: 'Performance Improvements',
emoji: 'π',
},
revert: {
description: 'Reverts a previous commit (only use in emergencies)',
title: 'Reverts',
emoji: 'π',
},
hotfix: {
description: 'For time-sensitive, emergency fixes (e.g., critical bugs that need to be fixed immediately)',
title: 'Hotfix',
emoji: 'π',
},
},
},
scope: {
description:
'What is the scope of this change?\n\n Do not use this CLI if type is `docs`.\n Use `git commit -m "docs(page-modified): message"` instead.\n\n',
},
subject: {
description: 'Write a short, imperative tense description of the change',
},
body: {
description: 'Provide a longer description of the change',
},
isBreaking: {
description: 'Are there any breaking changes?',
},
breakingBody: {
description:
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
},
breaking: {
description: 'Describe the breaking changes',
},
// isIssueAffected: {
// description: 'Does this change affect any open issues?',
// },
// issuesBody: {
// description:
// 'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
// },
issues: {
description: 'Add issue references (e.g. "fix #123", "re #123".)',
},
},
},
}
export default Configuration