-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
206 lines (201 loc) · 5.69 KB
/
commitlint.config.js
File metadata and controls
206 lines (201 loc) · 5.69 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
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
const AllowedScopes = ['apollo_base_layer_tests',
'apollo_batcher',
'apollo_batcher_config',
'apollo_batcher_types',
'apollo_central_sync',
'apollo_central_sync_config',
'apollo_class_manager',
'apollo_class_manager_config',
'apollo_class_manager_types',
'apollo_committer',
'apollo_committer_config',
'apollo_committer_types',
'apollo_compilation_utils',
'apollo_compile_to_casm',
'apollo_compile_to_casm_types',
'apollo_sierra_compilation_config',
'apollo_compile_to_native',
'apollo_compile_to_native_types',
'apollo_config',
'apollo_config_manager',
'apollo_config_manager_types',
'apollo_config_manager_config',
'apollo_consensus',
'apollo_consensus_config',
'apollo_consensus_manager',
'apollo_consensus_manager_config',
'apollo_consensus_orchestrator',
'apollo_consensus_orchestrator_config',
'apollo_dashboard',
'apollo_deployments',
'apollo_gateway',
'apollo_gateway_config',
'apollo_gateway_types',
'apollo_http_server',
'apollo_http_server_config',
'apollo_infra',
'apollo_infra_utils',
'apollo_integration_tests',
'apollo_l1_events',
'apollo_l1_events_config',
'apollo_l1_events_types',
'apollo_l1_gas_price',
'apollo_l1_gas_price_config',
'apollo_l1_gas_price_types',
'apollo_mempool',
'apollo_mempool_config',
'apollo_mempool_p2p',
'apollo_mempool_p2p_config',
'apollo_mempool_p2p_types',
'apollo_mempool_types',
'apollo_metrics',
'apollo_monitoring_endpoint',
'apollo_monitoring_endpoint_config',
'apollo_network',
'apollo_network_benchmark',
'apollo_network_types',
'apollo_node',
'apollo_node_config',
'apollo_p2p_sync',
'apollo_p2p_sync_config',
'apollo_proc_macros',
'apollo_proof_manager',
'apollo_proof_manager_types',
'apollo_protobuf',
'apollo_propeller',
'apollo_reverts',
'apollo_rpc',
'apollo_rpc_execution',
'apollo_signature_manager',
'apollo_signature_manager_types',
'apollo_sizeof',
'apollo_sizeof_macros',
'apollo_staking',
'apollo_staking_config',
'apollo_starknet_client',
'apollo_starknet_os_program',
'apollo_state_reader',
'apollo_state_sync',
'apollo_state_sync_config',
'apollo_state_sync_metrics',
'apollo_state_sync_types',
'apollo_storage',
'apollo_task_executor',
'apollo_test_utils',
'apollo_time',
'apollo_transaction_converter',
'apollo_versioned_constants',
'batcher',
'bench_tools',
'blockifier',
'blockifier_reexecution',
'blockifier_test_utils',
'cairo_native',
'ci',
'cursor_hooks',
'committer',
'deployment',
'echonet',
'infra',
'l1',
'mempool_test_utils',
'native_blockifier',
'proving_utils',
'papyrus_base_layer',
'papyrus_common',
'release',
'scripts',
'shared_execution_objects',
'signature',
'starknet_api',
'starknet_committer',
'starknet_committer_cli',
'starknet_committer_and_os_cli',
'starknet_os',
'starknet_os_flow_tests',
'starknet_proof_verifier',
'starknet_transaction_prover',
'starknet_patricia',
'starknet_patricia_storage',
'time',
'tower_ohttp',
'workspace',
'workspace_tests',
];
const Configuration = {
/*
* Resolve and load @commitlint/config-conventional from node_modules.
* Referenced packages must be installed
*/
//extends: ['@commitlint/config-conventional'],
/*
* Resolve and load conventional-changelog-atom from node_modules.
* Referenced packages must be installed
*/
// parserPreset: 'conventional-changelog-atom',
parserPreset: {
parserOpts: {
// Match: "scope1[,scope2...]: subject"
headerPattern: /^([\w,]+): (.+)$/,
headerCorrespondence: ['scope', 'subject'],
},
},
plugins: [
{
rules: {
'multi-scope-enum': ({ header }) => {
const match = header.match(/^([\w,]+):/);
if (!match) return [false, 'Cannot parse header'];
const scopes = match[1].split(',').map((s) => s.trim());
const invalid = scopes.filter((s) => !AllowedScopes.includes(s));
if (invalid.length > 0) {
return [false, `Invalid scope(s): ${invalid.join(', ')}`];
}
return [true];
},
},
},
],
/*
* Resolve and load @commitlint/format from node_modules.
* Referenced package must be installed
*/
formatter: '@commitlint/format',
/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
'scope-empty': [2, 'never'],
'scope-enum': [0], // Disable builtin (we validate via plugin).
'subject-empty': [2, 'never'],
'multi-scope-enum': [2, 'always'],
'type-empty': [0], // No type used.
'type-enum': [0],
'header-max-length': [2, 'always', 100],
},
/*
* Functions that return true if commitlint should ignore the given message.
*/
ignores: [(commit) => commit === ''],
/*
* Whether commitlint uses the default ignore rules.
*/
defaultIgnores: true,
/*
* Custom URL to show upon failure
*/
helpUrl:
'https://github.com/conventional-changelog/commitlint/#what-is-commitlint',
/*
* Custom prompt configs, not used currently.
*/
prompt: {
messages: {},
questions: {
type: {
description: 'please input type:',
},
},
},
};
module.exports = Configuration;