-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.ts
More file actions
64 lines (61 loc) · 2.08 KB
/
commitlint.config.ts
File metadata and controls
64 lines (61 loc) · 2.08 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
import { RuleConfigSeverity, type UserConfig } from '@commitlint/types';
import type { ParserOptions } from 'conventional-commits-parser';
const { CI } = process.env;
const isCI = CI && ['1', 'true', 'yes', 'y'].includes(CI.toLowerCase());
const formatter = isCI
? 'commitlint-format/gha-annotation'
: 'commitlint-format/default';
const config: UserConfig = {
formatter,
rules: {
'body-leading-blank': [RuleConfigSeverity.Error, 'always'],
'body-max-line-length': [RuleConfigSeverity.Error, 'always', 100],
'footer-leading-blank': [RuleConfigSeverity.Error, 'always'],
'footer-max-line-length': [RuleConfigSeverity.Error, 'always', 100],
'header-max-length': [RuleConfigSeverity.Error, 'always', 100],
'header-trim': [RuleConfigSeverity.Error, 'always'],
'subject-case': [
RuleConfigSeverity.Error,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case']
],
'subject-empty': [RuleConfigSeverity.Error, 'never'],
'subject-full-stop': [RuleConfigSeverity.Error, 'never', '.'],
'type-case': [RuleConfigSeverity.Error, 'always', 'lower-case'],
'type-empty': [RuleConfigSeverity.Error, 'never'],
'type-enum': [
RuleConfigSeverity.Error,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test'
]
]
},
parserPreset: {
parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
breakingHeaderPattern: /^(\w*)(?:\((.*)\))?!: (.*)$/,
headerCorrespondence: ['type', 'scope', 'subject'],
fieldPattern: /^-(.*?)-$/,
noteKeywords: ['BREAKING CHANGE', 'BREAKING-CHANGE'],
notesPattern: (noteKeywordsSelection: string) => {
return new RegExp(`^[\\s|*]*(${noteKeywordsSelection})[:\\s]+(.*)`);
},
revertPattern:
/^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
revertCorrespondence: ['header', 'hash'],
issuePrefixes: ['#']
} as ParserOptions
}
};
export default config;