Skip to content

Commit 725e143

Browse files
committed
✨ feat(version): release 1.0.0
0 parents  commit 725e143

File tree

4 files changed

+304
-0
lines changed

4 files changed

+304
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 - present Nor Cod
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# commitlint-config-git-commit-emoji
2+
3+
[![npm latest][version-img]][pkg-url]
4+
[![download][download-img]][pkg-url]
5+
[![MIT][license-img]](LICENSE)
6+
7+
Shareable `commitlint` config for the VS Code extension [git-commit-plugin](https://github.com/RedJue/git-commit-plugin) with emoji enabled.
8+
Use with [commitlint](https://github.com/conventional-changelog/commitlint).
9+
10+
## Getting started
11+
12+
```sh
13+
npm install --save-dev @commitlint/cli commitlint-config-git-commit-emoji
14+
15+
echo "module.exports = {extends: ['git-commit-emoji']};" > .commitlintrc.js
16+
```
17+
18+
## Format
19+
20+
```text
21+
<emoji> <type>(<scope>): <subject>
22+
<BLANK LINE>
23+
<body>
24+
<BLANK LINE>
25+
<footer>
26+
```
27+
28+
### Example
29+
30+
```text
31+
✨ feat(blog): add comment section
32+
```
33+
34+
## Rules
35+
36+
### Problems
37+
38+
The following rules are considered problems for `commitlint-config-git-commit-emoji` and will yield a non-zero exit code when not met.
39+
Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/reference-rules) for a list of available rules.
40+
41+
#### type-enum
42+
43+
- **condition**: `type` is found in value
44+
- **rule**: `always`
45+
- **value**
46+
47+
```text
48+
[
49+
'🎉 init',
50+
'✨ feat',
51+
'🐞 fix',
52+
'📃 docs',
53+
'🌈 style',
54+
'🦄 refactor',
55+
'🎈 perf',
56+
'🧪 test',
57+
'🔧 build',
58+
'🐎 ci',
59+
'🐳 chore',
60+
'↩ revert',
61+
]
62+
```
63+
64+
```sh
65+
echo "foo: some message" # fails
66+
echo "🐞 fix: some message" # passes
67+
```
68+
69+
#### type-case
70+
71+
- **description**: `type` is in case `value`
72+
- **rule**: `always`
73+
- **value**
74+
75+
```text
76+
'lowerCase'
77+
```
78+
79+
```sh
80+
echo "FIX: some message" # fails
81+
echo "🐞 fix: some message" # passes
82+
```
83+
84+
#### type-empty
85+
86+
- **condition**: `type` is empty
87+
- **rule**: `never`
88+
89+
```sh
90+
echo ": some message" # fails
91+
echo "🐞 fix: some message" # passes
92+
```
93+
94+
#### scope-case
95+
96+
- **condition**: `scope` is in case `value`
97+
- **rule**: `always`
98+
99+
```text
100+
'lowerCase'
101+
```
102+
103+
```sh
104+
echo "🐞 fix(SCOPE): some message" # fails
105+
echo "🐞 fix(scope): some message" # passes
106+
```
107+
108+
#### subject-case
109+
110+
- **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']`
111+
- **rule**: `never`
112+
113+
```sh
114+
echo "🐞 fix(SCOPE): Some message" # fails
115+
echo "🐞 fix(SCOPE): Some Message" # fails
116+
echo "🐞 fix(SCOPE): SomeMessage" # fails
117+
echo "🐞 fix(SCOPE): SOMEMESSAGE" # fails
118+
echo "🐞 fix(scope): some message" # passes
119+
echo "🐞 fix(scope): some Message" # passes
120+
```
121+
122+
#### subject-empty
123+
124+
- **condition**: `subject` is empty
125+
- **rule**: `never`
126+
127+
```sh
128+
echo "🐞 fix:" # fails
129+
echo "🐞 fix: some message" # passes
130+
```
131+
132+
#### subject-full-stop
133+
134+
- **condition**: `subject` ends with `value`
135+
- **rule**: `never`
136+
- **value**
137+
138+
```text
139+
'.'
140+
```
141+
142+
```sh
143+
echo "🐞 fix: some message." # fails
144+
echo "🐞 fix: some message" # passes
145+
```
146+
147+
#### subject-exclamation-mark
148+
149+
- **condition**: `subject` must not have a `!` before the `:` marker
150+
- **rule**: `never`
151+
152+
The [angular commit
153+
convention](hhttps://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit)
154+
dose not use a `!` to define a breaking change in the commit subject. If you
155+
want to use this feature please consider using the [conventional commit
156+
config](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#commitlintconfig-conventional).
157+
158+
#### header-max-length
159+
160+
- **condition**: `header` has `value` or less characters
161+
- **rule**: `always`
162+
- **value**
163+
164+
```text
165+
72
166+
```
167+
168+
```sh
169+
echo "🐞 fix: some message that is way too long and breaks the line max-length by several characters" # fails
170+
echo "🐞 fix: some message" # passes
171+
```
172+
173+
#### body-leading-blank
174+
175+
- **condition**: Body should have a leading blank line
176+
- **rule**: `always`
177+
178+
```sh
179+
echo "🐞 fix: some message
180+
body" # fails
181+
182+
echo "🐞 fix: some message
183+
184+
body" # passes
185+
```
186+
187+
#### footer-leading-blank
188+
189+
- **condition**: Footer should have a leading blank line
190+
- **rule**: `always`
191+
192+
```sh
193+
echo "🐞 fix: some message
194+
BREAKING CHANGE: It will be significant" # fails
195+
196+
echo "🐞 fix: some message
197+
198+
BREAKING CHANGE: It will be significant" # passes
199+
```
200+
201+
## Thanks
202+
203+
- Header regex pattern modified from [@gitmoji/parser-opts](https://github.com/arvinxx/gitmoji-commit-workflow/blob/master/packages/parser-opts/README.md)
204+
- Most of the rules come from [@commitlint/config-angular](https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-angular/README.md)
205+
206+
## License
207+
208+
[MIT](LICENSE) © Nor Cod
209+
210+
<!-- badge url -->
211+
212+
[pkg-url]: https://www.npmjs.com/package/commitlint-config-git-commit-emoji
213+
[version-img]: https://img.shields.io/npm/v/commitlint-config-git-commit-emoji?color=deepgreen&style=flat-square
214+
[download-img]: https://img.shields.io/npm/dm/commitlint-config-git-commit-emoji?style=flat-square
215+
[license-img]: https://img.shields.io/badge/license-MIT-blue?style=flat-square

index.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
parserPreset: {
3+
parserOpts: {
4+
headerPattern: /^(?<type>.*\s\w*)(?:\((?<scope>.*)\))?!?:\s(?<subject>(?:(?!#).)*(?:(?!\s).))$/,
5+
headerCorrespondence: ['type', 'scope', 'subject'],
6+
},
7+
},
8+
rules: {
9+
'body-leading-blank': [2, 'always'],
10+
'footer-leading-blank': [2, 'always'],
11+
'header-max-length': [2, 'always', 72],
12+
'scope-case': [2, 'always', 'lower-case'],
13+
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
14+
'subject-empty': [2, 'never'],
15+
'subject-exclamation-mark': [2, 'never'],
16+
'subject-full-stop': [2, 'never', '.'],
17+
'type-case': [2, 'always', 'lower-case'],
18+
'type-empty': [2, 'never'],
19+
'type-enum': [
20+
2,
21+
'always',
22+
[
23+
'🎉 init',
24+
'✨ feat',
25+
'🐞 fix',
26+
'📃 docs',
27+
'🌈 style',
28+
'🦄 refactor',
29+
'🎈 perf',
30+
'🧪 test',
31+
'🔧 build',
32+
'🐎 ci',
33+
'🐳 chore',
34+
'↩ revert',
35+
],
36+
],
37+
},
38+
};

package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "commitlint-config-git-commit-emoji",
3+
"version": "1.0.0",
4+
"description": "Shareable commitlint config for the VS Code extension git-commit-plugin with emoji enabled",
5+
"main": "index.js",
6+
"files": [
7+
"index.js"
8+
],
9+
"scripts": {
10+
"test": "echo \"Error: no test specified\" && exit 1"
11+
},
12+
"homepage": "https://github.com/ccnnde/commitlint-config-git-commit-emoji#readme",
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/ccnnde/commitlint-config-git-commit-emoji.git"
16+
},
17+
"bugs": {
18+
"url": "https://github.com/ccnnde/commitlint-config-git-commit-emoji/issues"
19+
},
20+
"keywords": [
21+
"commit",
22+
"commitlint",
23+
"commitlint-config",
24+
"angular",
25+
"emoji",
26+
"git"
27+
],
28+
"author": "Nor Cod <[email protected]>",
29+
"license": "MIT"
30+
}

0 commit comments

Comments
 (0)