UNPKG

3.37 kBMarkdownView Raw
1> Lint your commits, angular-style
2
3# @commitlint/config-angular
4
5Shareable `commitlint` config enforcing the [Angular commit convention](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit).
6Use with [@commitlint/cli](../cli) and [@commitlint/prompt-cli](../prompt-cli).
7
8## Getting started
9
10```sh
11npm install --save-dev @commitlint/config-angular @commitlint/cli
12echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint.config.js
13```
14
15## Rules
16
17### Problems
18
19The following rules are considered problems for `@commitlint/config-angular` and will yield a non-zero exit code when not met.
20Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/reference-rules) for a list of available rules.
21
22#### type-enum
23
24- **condition**: `type` is found in value
25- **rule**: `always`
26- **value**
27
28 ```
29 [
30 'build',
31 'ci',
32 'docs',
33 'feat',
34 'fix',
35 'perf',
36 'refactor',
37 'revert',
38 'style',
39 'test'
40 ]
41 ```
42
43```sh
44echo "foo: some message" # fails
45echo "fix: some message" # passes
46```
47
48#### type-case
49
50- **description**: `type` is in case `value`
51- **rule**: `always`
52- **value**
53 ```
54 'lowerCase'
55 ```
56
57```sh
58echo "FIX: some message" # fails
59echo "fix: some message" # passes
60```
61
62#### type-empty
63
64- **condition**: `type` is empty
65- **rule**: `never`
66
67```sh
68echo ": some message" # fails
69echo "fix: some message" # passes
70```
71
72#### scope-case
73
74- **condition**: `scope` is in case `value`
75- **rule**: `always`
76
77```
78'lowerCase'
79```
80
81```sh
82echo "fix(SCOPE): some message" # fails
83echo "fix(scope): some message" # passes
84```
85
86#### subject-case
87
88- **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']`
89- **rule**: `never`
90
91```sh
92echo "fix(SCOPE): Some message" # fails
93echo "fix(SCOPE): Some Message" # fails
94echo "fix(SCOPE): SomeMessage" # fails
95echo "fix(SCOPE): SOMEMESSAGE" # fails
96echo "fix(scope): some message" # passes
97echo "fix(scope): some Message" # passes
98```
99
100#### subject-empty
101
102- **condition**: `subject` is empty
103- **rule**: `never`
104
105```sh
106echo "fix:" # fails
107echo "fix: some message" # passes
108```
109
110#### subject-full-stop
111
112- **condition**: `subject` ends with `value`
113- **rule**: `never`
114- **value**
115
116```
117'.'
118```
119
120```sh
121echo "fix: some message." # fails
122echo "fix: some message" # passes
123```
124
125#### subject-exclamation-mark
126
127- **condition**: `subject` must not have a `!` before the `:` marker
128- **rule**: `never`
129
130The [angular commit
131convention](hhttps://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit)
132does not use a `!` to define a breaking change in the commit subject. If you
133want to use this feature please consider using the [conventional commit
134config](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#commitlintconfig-conventional).
135
136#### header-max-length
137
138- **condition**: `header` has `value` or less characters
139- **rule**: `always`
140- **value**
141
142```
14372
144```
145
146```sh
147echo "fix: some message that is way too long and breaks the line max-length by several characters" # fails
148echo "fix: some message" # passes
149```
150
151### Warnings
152
153The following rules are considered warnings for `@commitlint/config-angular` and will print warning messages when not met.
154
155#### body-leading-blank
156
157- **condition**: Body begins with blank line
158- **rule**: `always`