forked from volcengine/ai-app-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.ts
More file actions
49 lines (43 loc) · 1.49 KB
/
Copy pathcommitlint.config.ts
File metadata and controls
49 lines (43 loc) · 1.49 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
import type { UserConfig } from '@commitlint/types';
const ErrorSeverity = 2;
const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
formatter: '@commitlint/format',
rules: {
'type-enum': [
ErrorSeverity,
'always',
[
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
'release',
'license',
],
],
'scope-case': [ErrorSeverity, 'always', 'lower-case'],
'subject-max-length': [ErrorSeverity, 'always', 100],
'validate-scope': [ErrorSeverity, 'always'],
},
plugins: [
{
rules: {
'validate-scope': c => {
// Allow empty scopes for CI and Release types
if (!c.scope) return [['release', 'license'].includes(c.type), 'scope must be provided']
const allowedScopes = ['arkitect', 'demohouse/*'];
// 正则校验:arkitect 或 demohouse/ 开头
const isValid = /^(arkitect|demohouse\/.+|mcp\/.+)$/.test(c.scope);
return [isValid, `Scope must be one of ${allowedScopes.join(', ')}`];
},
}
}
],
helpUrl: 'https://github.com/volcengine/ai-app-lab/blob/main/docs/commitlint.md',
};
export default Configuration;