Skip to content

Commit a319ec8

Browse files
committed
docs: updated README
Explain changes from the original conventional-commit
1 parent bfde3ba commit a319ec8

File tree

2 files changed

+199
-27
lines changed

2 files changed

+199
-27
lines changed

README.md

Lines changed: 199 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,220 @@
1-
# @jcamp/starter-typescript
1+
> Lint your conventional commits, extended for use with [changelogen](https://github.com/unjs/changelogen)
22
3-
Setup an empty repo for TypeScript / NPM packages for an easy start for future projects.
3+
# commitlint-config-unjs
44

5-
# Integrations
5+
Shareable `commitlint` config enforcing [conventional commits](https://conventionalcommits.org/).
6+
Use with [@commitlint/cli](https://npm.im/@commitlint/cli) and [@commitlint/prompt-cli](https://npm.im/@commitlint/prompt-cli).
67

7-
## [Changelogen](https://github.com/unjs/changelogen)
8+
## Changes
89

9-
Creates / updates CHANGELOG.md; has GH Action for automatic release creation on GitHub
10+
Identical to [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional), with these changes:
1011

11-
Note for prerelease versions (0.x.x), considers the 0.x.0 as the major, with the 0.0.x as the minor.
12+
- Added `examples`, `types` for compatibility with [changelogen](https://github.com/unjs/changelogen)
13+
- Updated commitzen icons to match [changelogen](https://github.com/unjs/changelogen)
14+
- Added a `wip` type for commits that should not hit the changelog
1215

13-
## [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks)
16+
## Getting started
1417

15-
Easily allows GitHub hooks in a project \
16-
Used for commitlint and lintstaged below
18+
```sh
19+
npm install --save-dev @commitlint-config-unjs @commitlint/cli
20+
echo "module.exports = {extends: ['unjs']};" > commitlint.config.js
21+
```
1722

18-
## [commitlint](https://commitlint.js.org/#/)
23+
## Rules
1924

20-
Ensures commit messages follow conventions
25+
### Problems
2126

22-
## [lint-staged](https://github.com/okonet/lint-staged)
27+
The following rules are considered problems for `commitlint-config-unjs` and will yield a non-zero exit code when not met.
28+
29+
Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/reference-rules) for a list of available rules.
2330

24-
Lints all staged files to ensure code formatting is consistent.
31+
#### type-enum
2532

26-
## [Eslint Config](https://github.com/jcamp-code/eslint-config)
33+
- **condition**: `type` is found in value
34+
- **rule**: `always`
35+
- **level**: `error`
36+
- **value**
2737

28-
My preferred eslint / prettier setup; extends [@antfu's config](https://github.com/antfu/eslint-config)
38+
```
39+
[
40+
'build',
41+
'chore',
42+
'ci',
43+
'docs',
44+
'examples',
45+
'feat',
46+
'fix',
47+
'perf',
48+
'refactor',
49+
'revert',
50+
'style',
51+
'test',
52+
'types',
53+
'wip'
54+
];
55+
```
2956

30-
## [Prettier](https://prettier.io/)
57+
```sh
58+
echo "foo: some message" # fails
59+
echo "fix: some message" # passes
60+
```
3161

32-
Standardized code formatting
62+
#### type-case
3363

34-
## [Netlify](https://www.netlify.com)
64+
- **description**: `type` is in case `value`
65+
- **rule**: `always`
66+
- **level**: `error`
67+
- **value**
68+
```
69+
'lowerCase'
70+
```
3571

36-
Standard deploy file (obviously delete if not needed)
72+
```sh
73+
echo "FIX: some message" # fails
74+
echo "fix: some message" # passes
75+
```
3776

38-
## [Unbuild](https://github.com/unjs/unbuild)
77+
#### type-empty
3978

40-
Easy to use unified build system
79+
- **condition**: `type` is empty
80+
- **rule**: `never`
81+
- **level**: `error`
4182

42-
# Workflow
83+
```sh
84+
echo ": some message" # fails
85+
echo "fix: some message" # passes
86+
```
4387

44-
- Make changes
45-
- push commits / merge branches
46-
- `pnpm release` - updates changelog and release version, commits, tags and pushes; publishes too by default
47-
- GitHub Action creates GitHub release from the version (`v*`) tag
88+
#### subject-case
89+
90+
- **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']`
91+
- **rule**: `never`
92+
- **level**: `error`
93+
94+
```sh
95+
echo "fix(SCOPE): Some message" # fails
96+
echo "fix(SCOPE): Some Message" # fails
97+
echo "fix(SCOPE): SomeMessage" # fails
98+
echo "fix(SCOPE): SOMEMESSAGE" # fails
99+
echo "fix(scope): some message" # passes
100+
echo "fix(scope): some Message" # passes
101+
```
102+
103+
#### subject-empty
104+
105+
- **condition**: `subject` is empty
106+
- **rule**: `never`
107+
- **level**: `error`
108+
109+
```sh
110+
echo "fix:" # fails
111+
echo "fix: some message" # passes
112+
```
113+
114+
#### subject-full-stop
115+
116+
- **condition**: `subject` ends with `value`
117+
- **rule**: `never`
118+
- **level**: `error`
119+
- **value**
120+
121+
```
122+
'.'
123+
```
124+
125+
```sh
126+
echo "fix: some message." # fails
127+
echo "fix: some message" # passes
128+
```
129+
130+
#### header-max-length
131+
132+
- **condition**: `header` has `value` or less characters
133+
- **rule**: `always`
134+
- **level**: `error`
135+
- **value**
136+
137+
```
138+
100
139+
```
140+
141+
```sh
142+
echo "fix: some message that is way too long and breaks the line max-length by several characters" # fails
143+
echo "fix: some message" # passes
144+
```
145+
146+
#### footer-leading-blank
147+
148+
- **condition**: `footer` should have a leading blank line
149+
- **rule**: `always`
150+
- level: `warning`
151+
152+
```sh
153+
echo "fix: some message
154+
BREAKING CHANGE: It will be significant" # warning
155+
156+
echo "fix: some message
157+
158+
BREAKING CHANGE: It will be significant" # passes
159+
```
160+
161+
#### footer-max-line-length
162+
163+
- **condition**: `footer` each line has `value` or less characters
164+
- **rule**: `always`
165+
- level: `error`
166+
- **value**
167+
168+
```
169+
100
170+
```
171+
172+
```sh
173+
echo "fix: some message
174+
175+
BREAKING CHANGE: footer with multiple lines
176+
has a message that is way too long and will break the line rule 'line-max-length' by several characters" # fails
177+
178+
echo "fix: some message
179+
180+
BREAKING CHANGE: footer with multiple lines
181+
but still no line is too long" # passes
182+
```
183+
184+
#### body-leading-blank
185+
186+
- **condition**: `body` should have a leading blank line
187+
- **rule**: `always`
188+
- level: `warning`
189+
190+
```sh
191+
echo "fix: some message
192+
body" # warning
193+
194+
echo "fix: some message
195+
196+
body" # passes
197+
```
198+
199+
#### body-max-line-length
200+
201+
- **condition**: `body` each line has `value` or less characters
202+
- **rule**: `always`
203+
- level: `error`
204+
- **value**
205+
206+
```
207+
100
208+
```
209+
210+
```sh
211+
echo "fix: some message
212+
213+
body with multiple lines
214+
has a message that is way too long and will break the line rule 'line-max-length' by several characters" # fails
215+
216+
echo "fix: some message
217+
218+
body with multiple lines
219+
but still no line is too long" # passes
220+
```

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "commitlint-config-unjs",
33
"type": "module",
44
"version": "0.2.0",
5-
"private": true,
65
"description": "A commitlint config for unjs's changelogen tool",
76
"author": "John Campion",
87
"license": "MIT",

0 commit comments

Comments
 (0)