-
Notifications
You must be signed in to change notification settings - Fork 5
/
commit.rules.js
62 lines (51 loc) · 1.48 KB
/
commit.rules.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
/*
@see: https://commitlint.js.org/
Level [0..2]: 0 disables the rule. For 1 it will be considered a warning for 2 an error.
Applicable always|never: never inverts the rule.
Value: value to use for this rule.
```
<type>[optional scope]: <description>
[optional body]
[optional footer]
```
*/
const SUBJECT_MAX_LEN = 80;
const BODY_MAX_LEN = 1000;
const FOOTER_MAX_LEN = 1000;
// todo: missing rules like: `body-leading-case`, `footer-leading-case`
// eslint-disable-next-line no-undef
module.exports = {
rules: {
// subject
'subject-case': [
2,
'always',
[
// 'lower-case', // default
'sentence-case', // Sentence case
],
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'], // never end with period
'subject-max-length': [2, 'always', SUBJECT_MAX_LEN],
// type
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
// todo: need discuss
['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'],
],
// scope
'scope-empty': [1, 'never'],
'scope-case': [2, 'always', 'lower-case'], // value same as `type-case`
// body
'body-leading-blank': [2, 'always'],
'body-max-length': [2, 'always', BODY_MAX_LEN],
// footer
'footer-leading-blank': [1, 'always'],
'footer-max-length': [2, 'always', FOOTER_MAX_LEN],
'references-empty': [1, 'never'],
},
};