@commitlint/config-conventional
Advanced tools
Comparing version
115
index.js
module.exports = { | ||
parserPreset: 'conventional-changelog-conventionalcommits', | ||
rules: { | ||
'body-leading-blank': [1, 'always'], | ||
'body-max-line-length': [2, 'always', 100], | ||
'footer-leading-blank': [1, 'always'], | ||
'header-max-length': [2, 'always', 72], | ||
'scope-case': [2, 'always', 'lower-case'], | ||
'footer-max-line-length': [2, 'always', 100], | ||
'header-max-length': [2, 'always', 100], | ||
'subject-case': [ | ||
2, | ||
'never', | ||
['sentence-case', 'start-case', 'pascal-case', 'upper-case'] | ||
['sentence-case', 'start-case', 'pascal-case', 'upper-case'], | ||
], | ||
@@ -30,6 +32,105 @@ 'subject-empty': [2, 'never'], | ||
'style', | ||
'test' | ||
] | ||
] | ||
} | ||
'test', | ||
], | ||
], | ||
}, | ||
prompt: { | ||
questions: { | ||
type: { | ||
description: "Select the type of change that you're committing", | ||
enum: { | ||
feat: { | ||
description: 'A new feature', | ||
title: 'Features', | ||
emoji: '✨', | ||
}, | ||
fix: { | ||
description: 'A bug fix', | ||
title: 'Bug Fixes', | ||
emoji: '🐛', | ||
}, | ||
docs: { | ||
description: 'Documentation only changes', | ||
title: 'Documentation', | ||
emoji: '📚', | ||
}, | ||
style: { | ||
description: | ||
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)', | ||
title: 'Styles', | ||
emoji: '💎', | ||
}, | ||
refactor: { | ||
description: | ||
'A code change that neither fixes a bug nor adds a feature', | ||
title: 'Code Refactoring', | ||
emoji: '📦', | ||
}, | ||
perf: { | ||
description: 'A code change that improves performance', | ||
title: 'Performance Improvements', | ||
emoji: '🚀', | ||
}, | ||
test: { | ||
description: 'Adding missing tests or correcting existing tests', | ||
title: 'Tests', | ||
emoji: '🚨', | ||
}, | ||
build: { | ||
description: | ||
'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)', | ||
title: 'Builds', | ||
emoji: '🛠', | ||
}, | ||
ci: { | ||
description: | ||
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)', | ||
title: 'Continuous Integrations', | ||
emoji: '⚙️', | ||
}, | ||
chore: { | ||
description: "Other changes that don't modify src or test files", | ||
title: 'Chores', | ||
emoji: '♻️', | ||
}, | ||
revert: { | ||
description: 'Reverts a previous commit', | ||
title: 'Reverts', | ||
emoji: '🗑', | ||
}, | ||
}, | ||
}, | ||
scope: { | ||
description: | ||
'What is the scope of this change (e.g. component or file name)', | ||
}, | ||
subject: { | ||
description: | ||
'Write a short, imperative tense description of the change', | ||
}, | ||
body: { | ||
description: 'Provide a longer description of the change', | ||
}, | ||
isBreaking: { | ||
description: 'Are there any breaking changes?', | ||
}, | ||
breakingBody: { | ||
description: | ||
'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself', | ||
}, | ||
breaking: { | ||
description: 'Describe the breaking changes', | ||
}, | ||
isIssueAffected: { | ||
description: 'Does this change affect any open issues?', | ||
}, | ||
issuesBody: { | ||
description: | ||
'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself', | ||
}, | ||
issues: { | ||
description: 'Add issue references (e.g. "fix #123", "re #123".)', | ||
}, | ||
}, | ||
}, | ||
}; |
{ | ||
"name": "@commitlint/config-conventional", | ||
"version": "7.1.1", | ||
"version": "17.4.4", | ||
"description": "Shareable commitlint config enforcing conventional commits", | ||
@@ -9,10 +9,5 @@ "files": [ | ||
"scripts": { | ||
"clean": "exit 0", | ||
"deps": "dep-check", | ||
"pkg": "pkg-check", | ||
"lint": "xo", | ||
"start": "exit 0", | ||
"test": "exit 0" | ||
"pkg": "pkg-check" | ||
}, | ||
"xo": false, | ||
"publishConfig": { | ||
@@ -23,3 +18,4 @@ "access": "public" | ||
"type": "git", | ||
"url": "git+https://github.com/marionebl/commitlint.git" | ||
"url": "https://github.com/conventional-changelog/commitlint.git", | ||
"directory": "@commitlint/config-conventional" | ||
}, | ||
@@ -35,8 +31,16 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/marionebl/commitlint/issues" | ||
"url": "https://github.com/conventional-changelog/commitlint/issues" | ||
}, | ||
"homepage": "https://github.com/marionebl/commitlint#readme", | ||
"homepage": "https://commitlint.js.org/", | ||
"engines": { | ||
"node": ">=v14" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/utils": "^7.1.1" | ||
} | ||
"@commitlint/lint": "^17.4.4", | ||
"@commitlint/utils": "^17.4.0" | ||
}, | ||
"dependencies": { | ||
"conventional-changelog-conventionalcommits": "^5.0.0" | ||
}, | ||
"gitHead": "1aeec3c9b2c21cb8f0386398c24d8e7ed6eafbf0" | ||
} |
167
README.md
@@ -8,6 +8,2 @@ > Lint your conventional commits | ||
| :warning: | | | ||
|:-------:|--| | ||
| **IMPORTANT** | This is a direct replacement for [@commitlint/config-angular](https://npm.im/@commitlint/config-angular) prior to version 4. `config-angular` diverged from the conventional commit convention as of version 5. See [#146](https://github.com/marionebl/commitlint/issues/146) for details. | | ||
## Getting started | ||
@@ -21,2 +17,3 @@ | ||
## Rules | ||
### Problems | ||
@@ -26,15 +23,16 @@ | ||
Consult [docs/rules](https://marionebl.github.io/commitlint/#/reference-rules) for a list of available rules. | ||
Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/reference-rules) for a list of available rules. | ||
#### type-enum | ||
* **condition**: `type` is found in value | ||
* **rule**: `always` | ||
* **value** | ||
```js | ||
- **condition**: `type` is found in value | ||
- **rule**: `always` | ||
- **level**: `error` | ||
- **value** | ||
``` | ||
[ | ||
'build', | ||
'chore', | ||
'ci', | ||
'chore', | ||
'docs', | ||
@@ -48,3 +46,3 @@ 'feat', | ||
'test' | ||
] | ||
]; | ||
``` | ||
@@ -58,8 +56,10 @@ | ||
#### type-case | ||
* **description**: `type` is in case `value` | ||
* **rule**: `always` | ||
* **value** | ||
```js | ||
'lowerCase' | ||
- **description**: `type` is in case `value` | ||
- **rule**: `always` | ||
- **level**: `error` | ||
- **value** | ||
``` | ||
'lowerCase' | ||
``` | ||
@@ -72,5 +72,7 @@ ```sh | ||
#### type-empty | ||
* **condition**: `type` is empty | ||
* **rule**: `never` | ||
- **condition**: `type` is empty | ||
- **rule**: `never` | ||
- **level**: `error` | ||
```sh | ||
@@ -81,18 +83,8 @@ echo ": some message" # fails | ||
#### scope-case | ||
* **condition**: `scope` is in case `value` | ||
* **rule**: `always` | ||
```js | ||
'lowerCase' | ||
``` | ||
#### subject-case | ||
```sh | ||
echo "fix(SCOPE): some message" # fails | ||
echo "fix(scope): some message" # passes | ||
``` | ||
- **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']` | ||
- **rule**: `never` | ||
- **level**: `error` | ||
#### subject-case | ||
* **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']` | ||
* **rule**: `never` | ||
```sh | ||
@@ -108,5 +100,7 @@ echo "fix(SCOPE): Some message" # fails | ||
#### subject-empty | ||
* **condition**: `subject` is empty | ||
* **rule**: `never` | ||
- **condition**: `subject` is empty | ||
- **rule**: `never` | ||
- **level**: `error` | ||
```sh | ||
@@ -118,8 +112,11 @@ echo "fix:" # fails | ||
#### subject-full-stop | ||
* **condition**: `subject` ends with `value` | ||
* **rule**: `never` | ||
* **value** | ||
```js | ||
'.' | ||
- **condition**: `subject` ends with `value` | ||
- **rule**: `never` | ||
- **level**: `error` | ||
- **value** | ||
``` | ||
'.' | ||
``` | ||
@@ -131,10 +128,12 @@ ```sh | ||
#### header-max-length | ||
#### header-max-length | ||
* **condition**: `header` has `value` or less characters | ||
* **rule**: `always` | ||
* **value** | ||
```js | ||
72 | ||
- **condition**: `header` has `value` or less characters | ||
- **rule**: `always` | ||
- **level**: `error` | ||
- **value** | ||
``` | ||
100 | ||
``` | ||
@@ -145,1 +144,77 @@ ```sh | ||
``` | ||
#### footer-leading-blank | ||
- **condition**: `footer` should have a leading blank line | ||
- **rule**: `always` | ||
- level: `warning` | ||
```sh | ||
echo "fix: some message | ||
BREAKING CHANGE: It will be significant" # warning | ||
echo "fix: some message | ||
BREAKING CHANGE: It will be significant" # passes | ||
``` | ||
#### footer-max-line-length | ||
- **condition**: `footer` each line has `value` or less characters | ||
- **rule**: `always` | ||
- level: `error` | ||
- **value** | ||
``` | ||
100 | ||
``` | ||
```sh | ||
echo "fix: some message | ||
BREAKING CHANGE: footer with multiple lines | ||
has a message that is way too long and will break the line rule 'line-max-length' by several characters" # fails | ||
echo "fix: some message | ||
BREAKING CHANGE: footer with multiple lines | ||
but still no line is too long" # passes | ||
``` | ||
#### body-leading-blank | ||
- **condition**: `body` should have a leading blank line | ||
- **rule**: `always` | ||
- level: `warning` | ||
```sh | ||
echo "fix: some message | ||
body" # warning | ||
echo "fix: some message | ||
body" # passes | ||
``` | ||
#### body-max-line-length | ||
- **condition**: `body` each line has `value` or less characters | ||
- **rule**: `always` | ||
- level: `error` | ||
- **value** | ||
``` | ||
100 | ||
``` | ||
```sh | ||
echo "fix: some message | ||
body with multiple lines | ||
has a message that is way too long and will break the line rule 'line-max-length' by several characters" # fails | ||
echo "fix: some message | ||
body with multiple lines | ||
but still no line is too long" # passes | ||
``` |
9595
39.93%135
297.06%210
55.56%1
Infinity%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added