From dc77563259e979b42796c2333ae5a246bdce736c Mon Sep 17 00:00:00 2001 From: Mario Nebl Date: Thu, 6 Feb 2020 15:16:34 +1100 Subject: [PATCH] build: run prettier on everything (#962) * build: run prettier on everything * build: use prettier when any eligible file has changed * docs: fill list to protect against prettier garbling empty items * build: ignore changelog files * docs: avoid garbling example values * docs: avoid garbling example values * chore: add new reference Co-Authored-By: Armano * style: apply autoformatting Co-authored-by: Armano --- .devcontainer/devcontainer.json | 22 +- .editorconfig | 2 +- .github/CODE_OF_CONDUCT.md | 20 +- .github/CONTRIBUTING.md | 53 +- .github/ISSUE_TEMPLATE.md | 30 +- .github/PULL_REQUEST_TEMPLATE.md | 12 +- .prettierignore | 1 + .vscode/launch.json | 27 +- .vscode/settings.json | 4 +- @commitlint/cli/fixtures/husky/package.json | 8 +- @commitlint/cli/fixtures/signoff/package.json | 8 +- .../config-angular-type-enum/README.md | 2 +- @commitlint/config-angular/README.md | 84 ++- @commitlint/config-conventional/README.md | 78 +- .../fixtures/basic/lerna.json | 8 +- .../fixtures/basic/package.json | 10 +- .../fixtures/basic/packages/a/package.json | 4 +- .../fixtures/basic/packages/b/package.json | 4 +- .../fixtures/empty/lerna.json | 8 +- .../fixtures/empty/package.json | 10 +- .../fixtures/lerna-two/lerna.json | 8 +- .../fixtures/lerna-two/package.json | 10 +- .../fixtures/scoped/@packages/a/package.json | 4 +- .../fixtures/scoped/@packages/b/package.json | 4 +- .../fixtures/scoped/lerna.json | 8 +- .../fixtures/scoped/package.json | 10 +- @commitlint/config-lerna-scopes/readme.md | 1 + @commitlint/config-patternplate/README.md | 11 +- @commitlint/core/tsconfig.json | 16 +- @commitlint/ensure/tsconfig.json | 18 +- @commitlint/execute-rule/tsconfig.json | 21 +- @commitlint/format/README.md | 74 +- @commitlint/format/tsconfig.json | 21 +- @commitlint/is-ignored/tsconfig.json | 23 +- @commitlint/lint/README.md | 16 +- @commitlint/lint/tsconfig.json | 33 +- @commitlint/load/README.md | 5 +- .../parser-preset-angular/package.json | 10 +- .../package.json | 10 +- .../package.json | 10 +- .../recursive-extends-json/.commitlintrc.json | 8 +- .../recursive-extends-package/package.json | 10 +- .../recursive-extends-yaml/.commitlintrc.yml | 2 +- .../second-extended/package.json | 10 +- @commitlint/load/tsconfig.json | 31 +- @commitlint/message/tsconfig.json | 21 +- @commitlint/parse/README.md | 8 +- @commitlint/parse/tsconfig.json | 18 +- @commitlint/prompt/README.md | 1 + @commitlint/read/README.md | 10 +- .../recursive-extends-json/.commitlintrc.json | 8 +- .../recursive-extends-package/package.json | 10 +- .../recursive-extends-yaml/.commitlintrc.yml | 2 +- @commitlint/read/tsconfig.json | 25 +- @commitlint/resolve-extends/tsconfig.json | 21 +- @commitlint/rules/tsconfig.json | 33 +- @commitlint/to-lines/tsconfig.json | 21 +- @commitlint/top-level/tsconfig.json | 21 +- @commitlint/travis-cli/README.md | 4 +- @commitlint/types/package.json | 60 +- @commitlint/types/tsconfig.json | 20 +- @packages/test-environment/tsconfig.json | 21 +- @packages/test/tsconfig.json | 21 +- README.md | 144 ++-- docker-compose.yml | 7 +- docs/README.md | 18 +- docs/_sidebar.md | 32 +- docs/assets/commitlint.json | 681 ++++-------------- docs/concepts-commit-conventions.md | 8 +- docs/concepts-shareable-config.md | 2 +- docs/guides-ci-setup.md | 2 +- docs/guides-local-setup.md | 3 +- docs/guides-upgrade.md | 41 +- docs/guides-use-prompt.md | 1 + docs/index.html | 268 +++---- docs/reference-api.md | 168 +++-- docs/reference-configuration.md | 167 +++-- docs/reference-examples.md | 7 +- docs/reference-plugins.md | 20 +- docs/reference-rules.md | 546 ++++++++------ package.json | 9 +- tsconfig.json | 42 +- tsconfig.shared.json | 42 +- 83 files changed, 1473 insertions(+), 1829 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d36de54ff3..df93c1ca68 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,13 +1,13 @@ { - "name": "commitlint-dev", - "dockerComposeFile": ["../docker-compose.yml"], - "service": "commitlint", - "workspaceFolder": "/root/repo", - "shutdownAction": "stopCompose", - "extensions": [ - "editorconfig.editorconfig", - "ms-vsliveshare.vsliveshare-pack", - "ms-azuretools.vscode-docker", - "esbenp.prettier-vscode" - ] + "name": "commitlint-dev", + "dockerComposeFile": ["../docker-compose.yml"], + "service": "commitlint", + "workspaceFolder": "/root/repo", + "shutdownAction": "stopCompose", + "extensions": [ + "editorconfig.editorconfig", + "ms-vsliveshare.vsliveshare-pack", + "ms-azuretools.vscode-docker", + "esbenp.prettier-vscode" + ] } diff --git a/.editorconfig b/.editorconfig index 0186fe53aa..39506da27e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ insert_final_newline = true trim_trailing_whitespace = true indent_style = tab -[{.*rc,*.yml,*.md,package.json,lerna.json,tsconfig.json,tsconfig.*.json,*.svg}] +[{.*rc,*.yml,*.md,*.json,*.svg}] indent_style = space [*.md] diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index f7633cdee8..0147257dd9 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a7a46aec3d..9227d107c7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -6,52 +6,57 @@ Yeay! You want to contribute to commitlint. That's amazing! To smoothen everyone's experience involved with the project please take note of the following guidelines and rules. ## Found an Issue? + Thank you for reporting any issues you find. We do our best to test and make commitlint as solid as possible, but any reported issue is a real help. > commitlint issues Please follow these guidelines when reporting issues: -* Provide a title in the format of ` when ` -* Tag your issue with the tag `bug` -* Provide a short summary of what you are trying to do -* Provide the log of the encountered error if applicable -* Provide the exact version of commitlint. Check `npm ls @commitlint/cli` when in doubt -* Be awesome and consider contributing a [pull request](#want-to-contribute) + +- Provide a title in the format of ` when ` +- Tag your issue with the tag `bug` +- Provide a short summary of what you are trying to do +- Provide the log of the encountered error if applicable +- Provide the exact version of commitlint. Check `npm ls @commitlint/cli` when in doubt +- Be awesome and consider contributing a [pull request](#want-to-contribute) ## Want to contribute? + You consider contributing changes to commitlint – we dig that! Please consider these guidelines when filing a pull request: > commitlint pull requests -* Follow the [Coding Rules](#coding-rules) -* Follow the [Commit Rules](#commit-rules) -* Make sure you rebased the current master branch when filing the pull request -* Squash your commits when filing the pull request -* Provide a short title with a maximum of 100 characters -* Provide a more detailed description containing - * What you want to achieve - * What you changed - * What you added - * What you removed +- Follow the [Coding Rules](#coding-rules) +- Follow the [Commit Rules](#commit-rules) +- Make sure you rebased the current master branch when filing the pull request +- Squash your commits when filing the pull request +- Provide a short title with a maximum of 100 characters +- Provide a more detailed description containing + _ What you want to achieve + _ What you changed + _ What you added + _ What you removed ## Coding Rules + To keep the code base of commitlint neat and tidy the following rules apply to every change > Coding standards -* `prettier` is king -* Favor micro library over swiss army knives (rimraf, ncp vs. fs-extra) -* Be awesome +- `prettier` is king +- Favor micro library over swiss army knives (rimraf, ncp vs. fs-extra) +- Be awesome ## Commit Rules + To help everyone with understanding the commit history of commitlint the following commit rules are enforced. To make your life easier commitlint is commitizen-friendly and provides the npm run-script `commit`. > Commit standards -* [conventional-changelog](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/prompt) -* husky commit message hook available -* present tense -* maximum of 100 characters -* message format of `$type($scope): $message` +- [conventional-changelog](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/prompt) +- husky commit message hook available +- present tense +- maximum of 100 characters +- message format of `$type($scope): $message` diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index eabb0c9a9c..05a7b16e0b 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,30 +1,34 @@ ## Expected Behavior + ## Current Behavior + ## Affected packages -* [ ] cli -* [ ] core -* [ ] prompt -* [ ] config-angular + +- [ ] cli +- [ ] core +- [ ] prompt +- [ ] config-angular ## Possible Solution + ## Steps to Reproduce (for bugs) + -1. -2. -3. -4. + +1. First step +2. Second step
commitlint.config.js @@ -35,14 +39,16 @@
## Context + ## Your Environment + -| Executable | Version | -| ---: | :--- | +| Executable | Version | +| ---------------------: | :------ | | `commitlint --version` | VERSION | -| `git --version` | VERSION | -| `node --version` | VERSION | +| `git --version` | VERSION | +| `node --version` | VERSION | diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f3dfbc8d72..cca22af6cb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,20 +1,21 @@ ## Description + ## Motivation and Context + ## Usage examples + ```js // commitlint.config.js -module.exports = { - -}; +module.exports = {}; ``` ```sh @@ -22,17 +23,22 @@ echo "your commit message here" | commitlint # fails/passes ``` ## How Has This Been Tested? + ## Types of changes + + - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: + + - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. diff --git a/.prettierignore b/.prettierignore index c3af857904..6093e975dd 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ lib/ +CHANGELOG.md diff --git a/.vscode/launch.json b/.vscode/launch.json index a1d47c049f..3096b4ea7c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,21 +4,16 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Jest Test Current file", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", - "cwd": "${workspaceFolder}", - "args": [ - "--runInBand", - "--no-cache", - "--no-coverage", - "${fileBasename}" - ], - "sourceMaps": true, - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - } + { + "type": "node", + "request": "launch", + "name": "Jest Test Current file", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "cwd": "${workspaceFolder}", + "args": ["--runInBand", "--no-cache", "--no-coverage", "${fileBasename}"], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 55712c19f1..25fa6215fd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/@commitlint/cli/fixtures/husky/package.json b/@commitlint/cli/fixtures/husky/package.json index b58fe3a7b1..3f0ef85bae 100644 --- a/@commitlint/cli/fixtures/husky/package.json +++ b/@commitlint/cli/fixtures/husky/package.json @@ -1,6 +1,6 @@ { - "scripts": {}, - "devDependencies": { - "husky": "4.2.1" - } + "scripts": {}, + "devDependencies": { + "husky": "4.2.1" + } } diff --git a/@commitlint/cli/fixtures/signoff/package.json b/@commitlint/cli/fixtures/signoff/package.json index b58fe3a7b1..3f0ef85bae 100644 --- a/@commitlint/cli/fixtures/signoff/package.json +++ b/@commitlint/cli/fixtures/signoff/package.json @@ -1,6 +1,6 @@ { - "scripts": {}, - "devDependencies": { - "husky": "4.2.1" - } + "scripts": {}, + "devDependencies": { + "husky": "4.2.1" + } } diff --git a/@commitlint/config-angular-type-enum/README.md b/@commitlint/config-angular-type-enum/README.md index 1ee08c66de..ad912be470 100644 --- a/@commitlint/config-angular-type-enum/README.md +++ b/@commitlint/config-angular-type-enum/README.md @@ -23,7 +23,7 @@ echo "build: bar" | commitlint # passes ```js // commitlint.config.js -const types = require("@commitlint/config-angular-type-enum"); +const types = require('@commitlint/config-angular-type-enum'); // Use as rule creating errors for non-allowed types module.exports = { diff --git a/@commitlint/config-angular/README.md b/@commitlint/config-angular/README.md index 62ae7f98ae..76ac78b3a7 100644 --- a/@commitlint/config-angular/README.md +++ b/@commitlint/config-angular/README.md @@ -5,10 +5,6 @@ Shareable `commitlint` config enforcing the [Angular commit convention](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). Use with [@commitlint/cli](../cli) and [@commitlint/prompt-cli](../prompt-cli). -|:warning:| | -|:-------:|--| -| **IMPORTANT** | As of version 5.0.0 of this package the `chore` type is no longer allowed. This breaks compat with most of the tooling present in the conventional-changelog community. See [config-conventional](../config-conventional) for a replacement that retains compatibility. | - ## Getting started ```sh @@ -17,18 +13,19 @@ echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint. ``` ## Rules + ### Problems The following rules are considered problems for `@commitlint/config-angular` and will yield a non-zero exit code when not met. 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` +- **value** + + ``` [ 'build', 'ci', @@ -40,7 +37,7 @@ Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/refer 'revert', 'style', 'test' - ] + ] ``` ```sh @@ -49,11 +46,12 @@ echo "fix: some message" # passes ``` #### type-case -* **description**: `type` is in case `value` -* **rule**: `always` -* **value** - ```js - 'lowerCase' + +- **description**: `type` is in case `value` +- **rule**: `always` +- **value** + ``` + 'lowerCase' ``` ```sh @@ -62,8 +60,9 @@ echo "fix: some message" # passes ``` #### type-empty -* **condition**: `type` is empty -* **rule**: `never` + +- **condition**: `type` is empty +- **rule**: `never` ```sh echo ": some message" # fails @@ -71,10 +70,12 @@ echo "fix: some message" # passes ``` #### scope-case -* **condition**: `scope` is in case `value` -* **rule**: `always` -```js - 'lowerCase' + +- **condition**: `scope` is in case `value` +- **rule**: `always` + +``` +'lowerCase' ``` ```sh @@ -83,8 +84,9 @@ echo "fix(scope): some message" # passes ``` #### subject-case -* **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']` -* **rule**: `never` + +- **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']` +- **rule**: `never` ```sh echo "fix(SCOPE): Some message" # fails @@ -96,8 +98,9 @@ echo "fix(scope): some Message" # passes ``` #### subject-empty -* **condition**: `subject` is empty -* **rule**: `never` + +- **condition**: `subject` is empty +- **rule**: `never` ```sh echo "fix:" # fails @@ -105,11 +108,13 @@ echo "fix: some message" # passes ``` #### subject-full-stop -* **condition**: `subject` ends with `value` -* **rule**: `never` -* **value** -```js - '.' + +- **condition**: `subject` ends with `value` +- **rule**: `never` +- **value** + +``` +'.' ``` ```sh @@ -117,13 +122,14 @@ echo "fix: some message." # fails echo "fix: some message" # passes ``` - #### header-max-length -* **condition**: `header` has `value` or less characters -* **rule**: `always` -* **value** -```js - 72 + +- **condition**: `header` has `value` or less characters +- **rule**: `always` +- **value** + +``` +72 ``` ```sh @@ -132,8 +138,10 @@ echo "fix: some message" # passes ``` ### Warnings + The following rules are considered warnings for `@commitlint/config-angular` and will print warning messages when not met. #### body-leading-blank -* **condition**: Body begins with blank line -* **rule**: `always` + +- **condition**: Body begins with blank line +- **rule**: `always` diff --git a/@commitlint/config-conventional/README.md b/@commitlint/config-conventional/README.md index 1e31874593..60ba13cd35 100644 --- a/@commitlint/config-conventional/README.md +++ b/@commitlint/config-conventional/README.md @@ -5,10 +5,6 @@ Shareable `commitlint` config enforcing [conventional commits](https://conventionalcommits.org/). Use with [@commitlint/cli](https://npm.im/@commitlint/cli) and [@commitlint/prompt-cli](https://npm.im/@commitlint/prompt-cli). -| :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/conventional-changelog/commitlint/issues/146) for details. | - ## Getting started ```sh @@ -17,19 +13,20 @@ echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commit ``` ## Rules + ### Problems The following rules are considered problems for `@commitlint/config-conventional` and will yield a non-zero exit code when not met. 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` +- **value** + + ``` [ 'build', 'ci', @@ -42,7 +39,7 @@ Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/refer 'revert', 'style', 'test' - ] + ]; ``` ```sh @@ -51,11 +48,12 @@ echo "fix: some message" # passes ``` #### type-case -* **description**: `type` is in case `value` -* **rule**: `always` -* **value** - ```js - 'lowerCase' + +- **description**: `type` is in case `value` +- **rule**: `always` +- **value** + ``` + 'lowerCase' ``` ```sh @@ -64,8 +62,9 @@ echo "fix: some message" # passes ``` #### type-empty -* **condition**: `type` is empty -* **rule**: `never` + +- **condition**: `type` is empty +- **rule**: `never` ```sh echo ": some message" # fails @@ -73,10 +72,12 @@ echo "fix: some message" # passes ``` #### scope-case -* **condition**: `scope` is in case `value` -* **rule**: `always` -```js - 'lowerCase' + +- **condition**: `scope` is in case `value` +- **rule**: `always` + +``` +'lowerCase' ``` ```sh @@ -85,8 +86,9 @@ echo "fix(scope): some message" # passes ``` #### subject-case -* **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']` -* **rule**: `never` + +- **condition**: `subject` is in one of the cases `['sentence-case', 'start-case', 'pascal-case', 'upper-case']` +- **rule**: `never` ```sh echo "fix(SCOPE): Some message" # fails @@ -98,8 +100,9 @@ echo "fix(scope): some Message" # passes ``` #### subject-empty -* **condition**: `subject` is empty -* **rule**: `never` + +- **condition**: `subject` is empty +- **rule**: `never` ```sh echo "fix:" # fails @@ -107,11 +110,13 @@ echo "fix: some message" # passes ``` #### subject-full-stop -* **condition**: `subject` ends with `value` -* **rule**: `never` -* **value** -```js - '.' + +- **condition**: `subject` ends with `value` +- **rule**: `never` +- **value** + +``` +'.' ``` ```sh @@ -119,13 +124,14 @@ echo "fix: some message." # fails echo "fix: some message" # passes ``` - #### header-max-length -* **condition**: `header` has `value` or less characters -* **rule**: `always` -* **value** -```js - 100 + +- **condition**: `header` has `value` or less characters +- **rule**: `always` +- **value** + +``` +100 ``` ```sh diff --git a/@commitlint/config-lerna-scopes/fixtures/basic/lerna.json b/@commitlint/config-lerna-scopes/fixtures/basic/lerna.json index 7d013836f6..4beded578e 100644 --- a/@commitlint/config-lerna-scopes/fixtures/basic/lerna.json +++ b/@commitlint/config-lerna-scopes/fixtures/basic/lerna.json @@ -1,7 +1,5 @@ { - "lerna": "3.2.1", - "version": "1.0.0", - "packages": [ - "packages/*" - ] + "lerna": "3.2.1", + "version": "1.0.0", + "packages": ["packages/*"] } diff --git a/@commitlint/config-lerna-scopes/fixtures/basic/package.json b/@commitlint/config-lerna-scopes/fixtures/basic/package.json index e2ba59bfa5..005f3ae70a 100644 --- a/@commitlint/config-lerna-scopes/fixtures/basic/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/basic/package.json @@ -1,7 +1,7 @@ { - "name": "basic", - "version": "1.0.0", - "devDependencies": { - "lerna": "3.20.2" - } + "name": "basic", + "version": "1.0.0", + "devDependencies": { + "lerna": "3.20.2" + } } diff --git a/@commitlint/config-lerna-scopes/fixtures/basic/packages/a/package.json b/@commitlint/config-lerna-scopes/fixtures/basic/packages/a/package.json index 5693ad0511..9113c2528e 100644 --- a/@commitlint/config-lerna-scopes/fixtures/basic/packages/a/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/basic/packages/a/package.json @@ -1,4 +1,4 @@ { - "name": "a", - "version": "1.0.0" + "name": "a", + "version": "1.0.0" } diff --git a/@commitlint/config-lerna-scopes/fixtures/basic/packages/b/package.json b/@commitlint/config-lerna-scopes/fixtures/basic/packages/b/package.json index e63566ecae..c2d84cc127 100644 --- a/@commitlint/config-lerna-scopes/fixtures/basic/packages/b/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/basic/packages/b/package.json @@ -1,4 +1,4 @@ { - "name": "b", - "version": "1.0.0" + "name": "b", + "version": "1.0.0" } diff --git a/@commitlint/config-lerna-scopes/fixtures/empty/lerna.json b/@commitlint/config-lerna-scopes/fixtures/empty/lerna.json index 7d013836f6..4beded578e 100644 --- a/@commitlint/config-lerna-scopes/fixtures/empty/lerna.json +++ b/@commitlint/config-lerna-scopes/fixtures/empty/lerna.json @@ -1,7 +1,5 @@ { - "lerna": "3.2.1", - "version": "1.0.0", - "packages": [ - "packages/*" - ] + "lerna": "3.2.1", + "version": "1.0.0", + "packages": ["packages/*"] } diff --git a/@commitlint/config-lerna-scopes/fixtures/empty/package.json b/@commitlint/config-lerna-scopes/fixtures/empty/package.json index 43554010a3..9dc8be2d5a 100644 --- a/@commitlint/config-lerna-scopes/fixtures/empty/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/empty/package.json @@ -1,7 +1,7 @@ { - "name": "empty", - "version": "1.0.0", - "devDependencies": { - "lerna": "3.20.2" - } + "name": "empty", + "version": "1.0.0", + "devDependencies": { + "lerna": "3.20.2" + } } diff --git a/@commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json b/@commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json index 91353a207e..3e3994157f 100644 --- a/@commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json +++ b/@commitlint/config-lerna-scopes/fixtures/lerna-two/lerna.json @@ -1,7 +1,5 @@ { - "lerna": "2.4.0", - "version": "1.0.0", - "packages": [ - "packages/*" - ] + "lerna": "2.4.0", + "version": "1.0.0", + "packages": ["packages/*"] } diff --git a/@commitlint/config-lerna-scopes/fixtures/lerna-two/package.json b/@commitlint/config-lerna-scopes/fixtures/lerna-two/package.json index 5b52f8f9fe..00b9dc02e4 100644 --- a/@commitlint/config-lerna-scopes/fixtures/lerna-two/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/lerna-two/package.json @@ -1,7 +1,7 @@ { - "name": "version-mismatch", - "version": "1.0.0", - "devDependencies": { - "lerna": "2.11.0" - } + "name": "version-mismatch", + "version": "1.0.0", + "devDependencies": { + "lerna": "2.11.0" + } } diff --git a/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/a/package.json b/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/a/package.json index bd2d94edfe..7ba283037e 100644 --- a/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/a/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/a/package.json @@ -1,4 +1,4 @@ { - "name": "@packages/a", - "version": "1.0.0" + "name": "@packages/a", + "version": "1.0.0" } diff --git a/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/b/package.json b/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/b/package.json index f0c995bc44..3fd2cf7616 100644 --- a/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/b/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/scoped/@packages/b/package.json @@ -1,4 +1,4 @@ { - "name": "@packages/b", - "version": "1.0.0" + "name": "@packages/b", + "version": "1.0.0" } diff --git a/@commitlint/config-lerna-scopes/fixtures/scoped/lerna.json b/@commitlint/config-lerna-scopes/fixtures/scoped/lerna.json index 4fec852f4c..405f4392c4 100644 --- a/@commitlint/config-lerna-scopes/fixtures/scoped/lerna.json +++ b/@commitlint/config-lerna-scopes/fixtures/scoped/lerna.json @@ -1,7 +1,5 @@ { - "lerna": "3.2.1", - "version": "1.0.0", - "packages": [ - "@packages/*" - ] + "lerna": "3.2.1", + "version": "1.0.0", + "packages": ["@packages/*"] } diff --git a/@commitlint/config-lerna-scopes/fixtures/scoped/package.json b/@commitlint/config-lerna-scopes/fixtures/scoped/package.json index 65cb096c6b..8e7b40a75f 100644 --- a/@commitlint/config-lerna-scopes/fixtures/scoped/package.json +++ b/@commitlint/config-lerna-scopes/fixtures/scoped/package.json @@ -1,7 +1,7 @@ { - "name": "scoped", - "version": "1.0.0", - "devDependencies": { - "lerna": "3.20.2" - } + "name": "scoped", + "version": "1.0.0", + "devDependencies": { + "lerna": "3.20.2" + } } diff --git a/@commitlint/config-lerna-scopes/readme.md b/@commitlint/config-lerna-scopes/readme.md index c06db1343f..7c4784cb74 100644 --- a/@commitlint/config-lerna-scopes/readme.md +++ b/@commitlint/config-lerna-scopes/readme.md @@ -1,6 +1,7 @@ > Lint your commits, angular-style # @commitlint/config-lerna-scopes + Shareable `commitlint` config enforcing lerna package names as scopes. Use with [@commitlint/cli](../cli) and [@commitlint/prompt-cli](../prompt-cli). diff --git a/@commitlint/config-patternplate/README.md b/@commitlint/config-patternplate/README.md index cccc35be42..0ceb446100 100644 --- a/@commitlint/config-patternplate/README.md +++ b/@commitlint/config-patternplate/README.md @@ -1,25 +1,30 @@ > Lint your commits, patternplate-style # @commitlint/config-patternplate + Shareable `commitlint` config enforcing the patternplate commit convention. Use with [@commitlint/cli](../cli) and [@commitlint/prompt-cli](../prompt-cli). ## Getting started + ```sh npm install --save-dev @commitlint/config-patternplate @commitlint/cli echo "module.exports = {extends: ['@commitlint/config-patternplate']};" > commitlint.config.js ``` ## Rules + `@commitlint/config-patternplate` extends the [shareable angular config](../config-angular#rules). Additionally these rules apply: ### Problems + The following rules are considered problems for `@commitlint/config-patterplate` and will yield a non-zero exit code when not met. #### scope-enum -* **description**: `scope` is found in `value` -* **rule**: `always` -* **value**: determined based on pattern tree. `system` and all pattern ids present in `patterns` are allowed + +- **description**: `scope` is found in `value` +- **rule**: `always` +- **value**: determined based on pattern tree. `system` and all pattern ids present in `patterns` are allowed Consult [docs/rules](https://conventional-changelog.github.io/commitlint/#/reference-rules) for a list of available rules. diff --git a/@commitlint/core/tsconfig.json b/@commitlint/core/tsconfig.json index 433a665f64..8d5ce01f6d 100644 --- a/@commitlint/core/tsconfig.json +++ b/@commitlint/core/tsconfig.json @@ -1,10 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": ["./src/**/*.ts"], - "exclude": ["./src/**/*.test.ts", "./lib/**/*"] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src/**/*.ts"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@commitlint/ensure/tsconfig.json b/@commitlint/ensure/tsconfig.json index 84537266e0..f3092129e3 100644 --- a/@commitlint/ensure/tsconfig.json +++ b/@commitlint/ensure/tsconfig.json @@ -1,11 +1,11 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": ["./src/**/*.ts"], - "exclude": ["./src/**/*.test.ts", "./lib/**/*"], - "references": [{ "path": "../types" }] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src/**/*.ts"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"], + "references": [{"path": "../types"}] } diff --git a/@commitlint/execute-rule/tsconfig.json b/@commitlint/execute-rule/tsconfig.json index f4a57643f0..49479bf34f 100644 --- a/@commitlint/execute-rule/tsconfig.json +++ b/@commitlint/execute-rule/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@commitlint/format/README.md b/@commitlint/format/README.md index bc1a398d9b..7bd79eab97 100644 --- a/@commitlint/format/README.md +++ b/@commitlint/format/README.md @@ -13,41 +13,44 @@ npm install --save @commitlint/format ```js const format = require('@commitlint/format'); -const output = format({ - valid: false, - errorCount: 1, - warningCount: 1, - results: [ - { - valid: false, - input: 'some: commit message', - errors: [ - { - valid: false, - level: 2, - name: 'some-error', - message: 'This will show up red as it has level 2' - } - ], - warnings: [ - { - valid: true, - level: 0, - name: 'some-hint', - message: 'This will not show up as it has level 0' - }, - { - valid: false, - level: 1, - name: 'some-warning', - message: 'This will show up yellow as it has level 1' - } - ] - } - ] -}, { - color: false -}); +const output = format( + { + valid: false, + errorCount: 1, + warningCount: 1, + results: [ + { + valid: false, + input: 'some: commit message', + errors: [ + { + valid: false, + level: 2, + name: 'some-error', + message: 'This will show up red as it has level 2' + } + ], + warnings: [ + { + valid: true, + level: 0, + name: 'some-hint', + message: 'This will not show up as it has level 0' + }, + { + valid: false, + level: 1, + name: 'some-warning', + message: 'This will show up yellow as it has level 1' + } + ] + } + ] + }, + { + color: false + } +); process.stdout.write(output); @@ -60,4 +63,3 @@ process.stdout.write(output); ``` Consult [docs/api](https://conventional-changelog.github.io/commitlint/#/reference-api) for comprehensive documentation. - diff --git a/@commitlint/format/tsconfig.json b/@commitlint/format/tsconfig.json index f4a57643f0..49479bf34f 100644 --- a/@commitlint/format/tsconfig.json +++ b/@commitlint/format/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@commitlint/is-ignored/tsconfig.json b/@commitlint/is-ignored/tsconfig.json index a561833c69..f3092129e3 100644 --- a/@commitlint/is-ignored/tsconfig.json +++ b/@commitlint/is-ignored/tsconfig.json @@ -1,16 +1,11 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ], - "references": [{"path": "../types"}] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src/**/*.ts"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"], + "references": [{"path": "../types"}] } diff --git a/@commitlint/lint/README.md b/@commitlint/lint/README.md index 66095d2d9a..9f766bd597 100644 --- a/@commitlint/lint/README.md +++ b/@commitlint/lint/README.md @@ -13,13 +13,15 @@ npm install --save @commitlint/lint ```js const lint = require('@commitlint/lint'); -lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}) - .then(report => console.log(report)); - // => { valid: true, errors: [], warnings: [] } - -lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}) - .then(report => console.log(report)); - /* => +lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}).then(report => + console.log(report) +); +// => { valid: true, errors: [], warnings: [] } + +lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}).then(report => + console.log(report) +); +/* => { valid: true, errors: [], warnings: diff --git a/@commitlint/lint/tsconfig.json b/@commitlint/lint/tsconfig.json index 7b8a9e3c44..d30e6bdbf0 100644 --- a/@commitlint/lint/tsconfig.json +++ b/@commitlint/lint/tsconfig.json @@ -1,21 +1,16 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ], - "references": [ - {"path": "../is-ignored"}, - {"path": "../parse"}, - {"path": "../rules"}, - {"path": "../types"} - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"], + "references": [ + {"path": "../is-ignored"}, + {"path": "../parse"}, + {"path": "../rules"}, + {"path": "../types"} + ] } diff --git a/@commitlint/load/README.md b/@commitlint/load/README.md index b163d937a7..c74a7ffea6 100644 --- a/@commitlint/load/README.md +++ b/@commitlint/load/README.md @@ -8,13 +8,12 @@ npm install --save-dev @commitlint/load ``` -## Example +## Example ```js const load = require('@commitlint/load'); -load({extends: ['./package']}) -.then(config => console.log(config)); +load({extends: ['./package']}).then(config => console.log(config)); // => { extends: ['./package', './package-b'], rules: {} } ``` diff --git a/@commitlint/load/fixtures/parser-preset-angular/package.json b/@commitlint/load/fixtures/parser-preset-angular/package.json index 11129a7928..43419864cd 100644 --- a/@commitlint/load/fixtures/parser-preset-angular/package.json +++ b/@commitlint/load/fixtures/parser-preset-angular/package.json @@ -1,7 +1,7 @@ { - "name": "parser-preset-angular", - "version": "1.0.0", - "devDependencies": { - "conventional-changelog-angular": "5.0.6" - } + "name": "parser-preset-angular", + "version": "1.0.0", + "devDependencies": { + "conventional-changelog-angular": "5.0.6" + } } diff --git a/@commitlint/load/fixtures/parser-preset-conventional-without-factory/package.json b/@commitlint/load/fixtures/parser-preset-conventional-without-factory/package.json index 2c9cd17f70..bf73e5d3b9 100644 --- a/@commitlint/load/fixtures/parser-preset-conventional-without-factory/package.json +++ b/@commitlint/load/fixtures/parser-preset-conventional-without-factory/package.json @@ -1,7 +1,7 @@ { - "name": "parser-preset-conventional-without-factory", - "version": "1.0.0", - "devDependencies": { - "conventional-changelog-conventionalcommits": "4.2.3" - } + "name": "parser-preset-conventional-without-factory", + "version": "1.0.0", + "devDependencies": { + "conventional-changelog-conventionalcommits": "4.2.3" + } } diff --git a/@commitlint/load/fixtures/parser-preset-conventionalcommits/package.json b/@commitlint/load/fixtures/parser-preset-conventionalcommits/package.json index 73bab0845a..ddf3e0fc81 100644 --- a/@commitlint/load/fixtures/parser-preset-conventionalcommits/package.json +++ b/@commitlint/load/fixtures/parser-preset-conventionalcommits/package.json @@ -1,7 +1,7 @@ { - "name": "parser-preset-conventionalcommits", - "version": "1.0.0", - "devDependencies": { - "conventional-changelog-conventionalcommits": "4.2.3" - } + "name": "parser-preset-conventionalcommits", + "version": "1.0.0", + "devDependencies": { + "conventional-changelog-conventionalcommits": "4.2.3" + } } diff --git a/@commitlint/load/fixtures/recursive-extends-json/.commitlintrc.json b/@commitlint/load/fixtures/recursive-extends-json/.commitlintrc.json index b0feb26419..9a5e8e1d9f 100644 --- a/@commitlint/load/fixtures/recursive-extends-json/.commitlintrc.json +++ b/@commitlint/load/fixtures/recursive-extends-json/.commitlintrc.json @@ -1,6 +1,6 @@ { - "extends": ["./first-extended"], - "rules": { - "zero": 0 - } + "extends": ["./first-extended"], + "rules": { + "zero": 0 + } } diff --git a/@commitlint/load/fixtures/recursive-extends-package/package.json b/@commitlint/load/fixtures/recursive-extends-package/package.json index 031a432619..1818049244 100644 --- a/@commitlint/load/fixtures/recursive-extends-package/package.json +++ b/@commitlint/load/fixtures/recursive-extends-package/package.json @@ -1,8 +1,10 @@ { "commitlint": { - "extends": ["./first-extended"], - "rules": { - "zero": 0 - } + "extends": [ + "./first-extended" + ], + "rules": { + "zero": 0 + } } } diff --git a/@commitlint/load/fixtures/recursive-extends-yaml/.commitlintrc.yml b/@commitlint/load/fixtures/recursive-extends-yaml/.commitlintrc.yml index b76a5986b3..a5ef7fdffd 100644 --- a/@commitlint/load/fixtures/recursive-extends-yaml/.commitlintrc.yml +++ b/@commitlint/load/fixtures/recursive-extends-yaml/.commitlintrc.yml @@ -1,4 +1,4 @@ extends: -- "./first-extended" + - './first-extended' rules: zero: 0 diff --git a/@commitlint/load/fixtures/recursive-parser-preset-conventional-atom/first-extended/second-extended/package.json b/@commitlint/load/fixtures/recursive-parser-preset-conventional-atom/first-extended/second-extended/package.json index ae831e512d..4d37766e0b 100644 --- a/@commitlint/load/fixtures/recursive-parser-preset-conventional-atom/first-extended/second-extended/package.json +++ b/@commitlint/load/fixtures/recursive-parser-preset-conventional-atom/first-extended/second-extended/package.json @@ -1,7 +1,7 @@ { - "name": "@second-extend/recursive-parser-preset-conventional-atom", - "version": "1.0.0", - "devDependencies": { - "conventional-changelog-atom": "2.0.3" - } + "name": "@second-extend/recursive-parser-preset-conventional-atom", + "version": "1.0.0", + "devDependencies": { + "conventional-changelog-atom": "2.0.3" + } } diff --git a/@commitlint/load/tsconfig.json b/@commitlint/load/tsconfig.json index baa69a842d..51cdcedab0 100644 --- a/@commitlint/load/tsconfig.json +++ b/@commitlint/load/tsconfig.json @@ -1,20 +1,15 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ], - "references": [ - { "path": "../execute-rule" }, - { "path": "../resolve-extends" }, - { "path": "../types" } - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"], + "references": [ + {"path": "../execute-rule"}, + {"path": "../resolve-extends"}, + {"path": "../types"} + ] } diff --git a/@commitlint/message/tsconfig.json b/@commitlint/message/tsconfig.json index f4a57643f0..49479bf34f 100644 --- a/@commitlint/message/tsconfig.json +++ b/@commitlint/message/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@commitlint/parse/README.md b/@commitlint/parse/README.md index 6914b3be8d..be40697885 100644 --- a/@commitlint/parse/README.md +++ b/@commitlint/parse/README.md @@ -18,10 +18,10 @@ const parse = require('@commitlint/parse'); ### parse(message: string, parser: Function, parserOpts: Object) -* **message**: Commit message to parser -* **parser**: Sync parser function to use. Defaults to `sync` of `conventional-commits-parser` -* **parserOpts**: Options to pass to `parser` - ```js +- **message**: Commit message to parser +- **parser**: Sync parser function to use. Defaults to `sync` of `conventional-commits-parser` +- **parserOpts**: Options to pass to `parser` + ``` { commentChar: null, // character indicating comment lines issuePrefixes: ['#'] // prefix characters for issue references diff --git a/@commitlint/parse/tsconfig.json b/@commitlint/parse/tsconfig.json index ffd5b0f116..119e645565 100644 --- a/@commitlint/parse/tsconfig.json +++ b/@commitlint/parse/tsconfig.json @@ -1,11 +1,11 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": ["./src"], - "exclude": ["./src/**/*.test.ts", "./lib/**/*"], - "references": [{"path": "../types"}] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"], + "references": [{"path": "../types"}] } diff --git a/@commitlint/prompt/README.md b/@commitlint/prompt/README.md index 55f18044e1..bb7d7b8fa1 100644 --- a/@commitlint/prompt/README.md +++ b/@commitlint/prompt/README.md @@ -14,6 +14,7 @@ echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commit ``` In package.json + ``` { "scripts": { diff --git a/@commitlint/read/README.md b/@commitlint/read/README.md index 4b0c993aa8..26a7e0d1d4 100644 --- a/@commitlint/read/README.md +++ b/@commitlint/read/README.md @@ -14,14 +14,12 @@ npm install --save @commitlint/read const read = require('@commitlint/read'); // Read last edited commit message -read({edit: true}) - .then(messages => console.log(messages)); - // => ['I did something\n\n'] +read({edit: true}).then(messages => console.log(messages)); +// => ['I did something\n\n'] // Read from the third to second commit message from HEAD -read({from: 'HEAD~2', to: 'HEAD~1'}) - .then(messages => console.log(messages)); - // => ['Initial commit\n\n'] +read({from: 'HEAD~2', to: 'HEAD~1'}).then(messages => console.log(messages)); +// => ['Initial commit\n\n'] ``` Consult [docs/api](https://conventional-changelog.github.io/commitlint/#/reference-api) for comprehensive documentation. diff --git a/@commitlint/read/fixtures/recursive-extends-json/.commitlintrc.json b/@commitlint/read/fixtures/recursive-extends-json/.commitlintrc.json index b0feb26419..9a5e8e1d9f 100644 --- a/@commitlint/read/fixtures/recursive-extends-json/.commitlintrc.json +++ b/@commitlint/read/fixtures/recursive-extends-json/.commitlintrc.json @@ -1,6 +1,6 @@ { - "extends": ["./first-extended"], - "rules": { - "zero": 0 - } + "extends": ["./first-extended"], + "rules": { + "zero": 0 + } } diff --git a/@commitlint/read/fixtures/recursive-extends-package/package.json b/@commitlint/read/fixtures/recursive-extends-package/package.json index 031a432619..1818049244 100644 --- a/@commitlint/read/fixtures/recursive-extends-package/package.json +++ b/@commitlint/read/fixtures/recursive-extends-package/package.json @@ -1,8 +1,10 @@ { "commitlint": { - "extends": ["./first-extended"], - "rules": { - "zero": 0 - } + "extends": [ + "./first-extended" + ], + "rules": { + "zero": 0 + } } } diff --git a/@commitlint/read/fixtures/recursive-extends-yaml/.commitlintrc.yml b/@commitlint/read/fixtures/recursive-extends-yaml/.commitlintrc.yml index b76a5986b3..a5ef7fdffd 100644 --- a/@commitlint/read/fixtures/recursive-extends-yaml/.commitlintrc.yml +++ b/@commitlint/read/fixtures/recursive-extends-yaml/.commitlintrc.yml @@ -1,4 +1,4 @@ extends: -- "./first-extended" + - './first-extended' rules: zero: 0 diff --git a/@commitlint/read/tsconfig.json b/@commitlint/read/tsconfig.json index 5eb707a721..f54e2e29b1 100644 --- a/@commitlint/read/tsconfig.json +++ b/@commitlint/read/tsconfig.json @@ -1,18 +1,11 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ], - "references": [ - { "path": "../top-level" } - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"], + "references": [{"path": "../top-level"}] } diff --git a/@commitlint/resolve-extends/tsconfig.json b/@commitlint/resolve-extends/tsconfig.json index f4a57643f0..49479bf34f 100644 --- a/@commitlint/resolve-extends/tsconfig.json +++ b/@commitlint/resolve-extends/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@commitlint/rules/tsconfig.json b/@commitlint/rules/tsconfig.json index 1cafd13cb7..3f6d480309 100644 --- a/@commitlint/rules/tsconfig.json +++ b/@commitlint/rules/tsconfig.json @@ -1,21 +1,16 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ], - "references": [ - { "path": "../ensure" }, - { "path": "../message" }, - { "path": "../to-lines" }, - { "path": "../types" }, - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"], + "references": [ + {"path": "../ensure"}, + {"path": "../message"}, + {"path": "../to-lines"}, + {"path": "../types"} + ] } diff --git a/@commitlint/to-lines/tsconfig.json b/@commitlint/to-lines/tsconfig.json index f4a57643f0..49479bf34f 100644 --- a/@commitlint/to-lines/tsconfig.json +++ b/@commitlint/to-lines/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@commitlint/top-level/tsconfig.json b/@commitlint/top-level/tsconfig.json index f4a57643f0..49479bf34f 100644 --- a/@commitlint/top-level/tsconfig.json +++ b/@commitlint/top-level/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@commitlint/travis-cli/README.md b/@commitlint/travis-cli/README.md index a85348bf77..74b29545f4 100644 --- a/@commitlint/travis-cli/README.md +++ b/@commitlint/travis-cli/README.md @@ -2,7 +2,7 @@ # @commitlint/travis-cli -This package is a convenience wrapper around `commitlint`, +This package is a convenience wrapper around `commitlint`, providing zero-configuration linting of all relevant commits for a given change/build combination. @@ -15,5 +15,5 @@ npm install --save-dev @commitlint/travis-cli ```yml # .travis.yml script - - commitlint-travis +- commitlint-travis ``` diff --git a/@commitlint/types/package.json b/@commitlint/types/package.json index 412cc10620..56bcb55bcf 100644 --- a/@commitlint/types/package.json +++ b/@commitlint/types/package.json @@ -1,32 +1,32 @@ { - "name": "@commitlint/types", - "version": "8.3.5", - "description": "Shared types for commitlint packages", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "files": [ - "lib/" - ], - "scripts": { - "pkg": "pkg-check" - }, - "engines": { - "node": ">=8" - }, - "repository": { - "type": "git", - "url": "https://github.com/conventional-changelog/commitlint.git" - }, - "bugs": { - "url": "https://github.com/conventional-changelog/commitlint/issues" - }, - "homepage": "https://github.com/conventional-changelog/commitlint#readme", - "author": { - "name": "Mario Nebl", - "email": "hello@herebecode.com" - }, - "license": "MIT", - "devDependencies": { - "@commitlint/utils": "^8.3.4" - } + "name": "@commitlint/types", + "version": "8.3.5", + "description": "Shared types for commitlint packages", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib/" + ], + "scripts": { + "pkg": "pkg-check" + }, + "engines": { + "node": ">=8" + }, + "repository": { + "type": "git", + "url": "https://github.com/conventional-changelog/commitlint.git" + }, + "bugs": { + "url": "https://github.com/conventional-changelog/commitlint/issues" + }, + "homepage": "https://github.com/conventional-changelog/commitlint#readme", + "author": { + "name": "Mario Nebl", + "email": "hello@herebecode.com" + }, + "license": "MIT", + "devDependencies": { + "@commitlint/utils": "^8.3.4" + } } diff --git a/@commitlint/types/tsconfig.json b/@commitlint/types/tsconfig.json index f9b6b7f3f1..d5ce29824f 100644 --- a/@commitlint/types/tsconfig.json +++ b/@commitlint/types/tsconfig.json @@ -1,14 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src" - ], - "exclude": [ - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "exclude": ["./lib/**/*"] } diff --git a/@packages/test-environment/tsconfig.json b/@packages/test-environment/tsconfig.json index a38b053b3c..8d5ce01f6d 100644 --- a/@packages/test-environment/tsconfig.json +++ b/@packages/test-environment/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src/**/*.ts"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/@packages/test/tsconfig.json b/@packages/test/tsconfig.json index f3d0083154..8d5ce01f6d 100644 --- a/@packages/test/tsconfig.json +++ b/@packages/test/tsconfig.json @@ -1,15 +1,10 @@ { - "extends": "../../tsconfig.shared.json", - "compilerOptions": { - "composite": true, - "rootDir": "./src", - "outDir": "./lib" - }, - "include": [ - "./src/**/*.ts" - ], - "exclude": [ - "./src/**/*.test.ts", - "./lib/**/*" - ] + "extends": "../../tsconfig.shared.json", + "compilerOptions": { + "composite": true, + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src/**/*.ts"], + "exclude": ["./src/**/*.test.ts", "./lib/**/*"] } diff --git a/README.md b/README.md index ea8d529428..bed9be00ce 100644 --- a/README.md +++ b/README.md @@ -6,55 +6,62 @@

-> Demo generated with [svg-term-cli](https://github.com/marionebl/svg-term-cli) +> Demo generated with [svg-term-cli](https://github.com/marionebl/svg-term-cli) > > `cat docs/assets/commitlint.json | svg-term --out docs/assets/commitlint.svg --frame --profile=Seti --height=20 --width=80` [![npm latest][2]][3] [![CircleCI][4]][5] - -* 🚓 Be a good `commitizen` -* 📦 Share configuration via `npm` -* 🤖 Tap into `conventional-changelog` +- 🚓 Be a good `commitizen` +- 📦 Share configuration via `npm` +- 🤖 Tap into `conventional-changelog` ## Contents -* [What is commitlint](#what-is-commitlint) - * [Benefits using commitlint](#benefits-using-commitlint) -* [Getting started](#getting-started) -* [CLI](#cli) -* [Config](#config) -* [Shared configuration](#shared-configuration) -* [API](#api) -* [Tools](#tools) -* [Roadmap](#roadmap) -* [Version Support](#version-support) -* [Related projects](#related-projects) -* [License](#license) -* [Development](#development) - * [Install and run](#install-and-run) - * [Publishing a release](#publishing-a-release) - -* * * +- [What is commitlint](#what-is-commitlint) + - [Benefits using commitlint](#benefits-using-commitlint) +- [Getting started](#getting-started) +- [CLI](#cli) +- [Config](#config) +- [Shared configuration](#shared-configuration) +- [API](#api) +- [Tools](#tools) +- [Roadmap](#roadmap) +- [Version Support](#version-support) +- [Related projects](#related-projects) +- [License](#license) +- [Development](#development) + - [Install and run](#install-and-run) + - [Publishing a release](#publishing-a-release) + +--- ## What is commitlint + commitlint checks if your commit messages meet the [conventional commit format](https://conventionalcommits.org). In general the pattern mostly looks like this: + ```sh type(scope?): subject #scope is optional ``` + Real world examples can look like this: + ``` chore: run tests on travis ci ``` + ``` fix(server): send cors headers ``` + ``` feat(blog): add comment section ``` + Common types according to [commitlint-config-conventional (based on the the Angular convention)](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum) can be: + - build - ci - chore @@ -70,10 +77,10 @@ Common types according to [commitlint-config-conventional (based on the the Angu These can be modified by [your own configuration](#config). ### Benefits using commitlint + - [Why Use Conventional Commits?](https://www.conventionalcommits.org/en/v1.0.0-beta.2/#why-use-conventional-commits) - ["The perks of committing with conventions" (Talk slides)](https://slides.com/marionebl/the-perks-of-committing-with-conventions#/) - ## Getting started ```sh @@ -86,97 +93,96 @@ npm install --save-dev @commitlint/config-conventional @commitlint/cli echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js ``` - To lint commits before they are created you can use Husky's 'commit-msg' hook: + ```json { "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } + } } } ``` - **Detailed Setup instructions** -* [Local setup](https://conventional-changelog.github.io/commitlint/#/guides-local-setup) - Lint messages on commit with husky -* [CI setup](https://conventional-changelog.github.io/commitlint/#/guides-ci-setup) - Lint messages during CI builds - +- [Local setup](https://conventional-changelog.github.io/commitlint/#/guides-local-setup) - Lint messages on commit with husky +- [CI setup](https://conventional-changelog.github.io/commitlint/#/guides-ci-setup) - Lint messages during CI builds ## CLI -* Primary way to interact with commitlint. -* `npm install --save-dev @commitlint/cli` -* Packages: [cli](./@commitlint/cli) +- Primary way to interact with commitlint. +- `npm install --save-dev @commitlint/cli` +- Packages: [cli](./@commitlint/cli) ## Config -* Configuration is picked up from `commitlint.config.js`, `.commitlintrc.js`, `.commitlintrc.json`, or `.commitlintrc.yml` file or a `commitlint` field in `package.json` -* Packages: [cli](./@commitlint/cli), [core](./@commitlint/core) -* See [Rules](./docs/reference-rules.md) for a complete list of possible rules -* An example configuration can be found at [@commitlint/config-conventional](./@commitlint/config-conventional/index.js) +- Configuration is picked up from `commitlint.config.js`, `.commitlintrc.js`, `.commitlintrc.json`, or `.commitlintrc.yml` file or a `commitlint` field in `package.json` +- Packages: [cli](./@commitlint/cli), [core](./@commitlint/core) +- See [Rules](./docs/reference-rules.md) for a complete list of possible rules +- An example configuration can be found at [@commitlint/config-conventional](./@commitlint/config-conventional/index.js) ## Shared configuration A number of shared configurations are available to install and use with `commitlint`: -* [@commitlint/config-angular](./@commitlint/config-angular) -* [@commitlint/config-conventional](./@commitlint/config-conventional) -* [@commitlint/config-lerna-scopes](./@commitlint/config-lerna-scopes) -* [@commitlint/config-patternplate](./@commitlint/config-patternplate) -* [conventional-changelog-lint-config-atom](https://github.com/erikmueller/conventional-changelog-lint-config-atom) -* [conventional-changelog-lint-config-canonical](https://github.com/gajus/conventional-changelog-lint-config-canonical) -* [commitlint-config-jira](https://github.com/Gherciu/commitlint-jira) +- [@commitlint/config-angular](./@commitlint/config-angular) +- [@commitlint/config-conventional](./@commitlint/config-conventional) +- [@commitlint/config-lerna-scopes](./@commitlint/config-lerna-scopes) +- [@commitlint/config-patternplate](./@commitlint/config-patternplate) +- [conventional-changelog-lint-config-atom](https://github.com/erikmueller/conventional-changelog-lint-config-atom) +- [conventional-changelog-lint-config-canonical](https://github.com/gajus/conventional-changelog-lint-config-canonical) +- [commitlint-config-jira](https://github.com/Gherciu/commitlint-jira) ->⚠️ If you want to publish your own shareable config then make sure it has a name aligning with the pattern `commitlint-config-emoji-log` or `commitlint-config-your-config-name` — then in extend all you have to write is `emoji-log` or `your-config-name`. +> ⚠️ If you want to publish your own shareable config then make sure it has a name aligning with the pattern `commitlint-config-emoji-log` or `commitlint-config-your-config-name` — then in extend all you have to write is `emoji-log` or `your-config-name`. ## API -* Alternative, programmatic way to interact with `commitlint` -* Packages: - * [format](./@commitlint/format) - Format commitlint reports - * [lint](./@commitlint/lint) - Lint a string against commitlint rules - * [load](./@commitlint/load) - Load shared commitlint configuration - * [read](./@commitlint/read) - Read commit messages from a specified range or last edit -* See [API](./docs/reference-api.md) for a complete list of methods and examples +- Alternative, programmatic way to interact with `commitlint` +- Packages: + - [format](./@commitlint/format) - Format commitlint reports + - [lint](./@commitlint/lint) - Lint a string against commitlint rules + - [load](./@commitlint/load) - Load shared commitlint configuration + - [read](./@commitlint/read) - Read commit messages from a specified range or last edit +- See [API](./docs/reference-api.md) for a complete list of methods and examples ## Tools -* [commitizen adapter](./@commitlint/prompt) -* [prompt](./@commitlint/prompt-cli) +- [commitizen adapter](./@commitlint/prompt) +- [prompt](./@commitlint/prompt-cli) ## Roadmap > **Ideas**: [conventional-changelog/commitlint#94](https://github.com/conventional-changelog/commitlint/issues/94) -`commitlint` is considered stable and is used in various projects as development tool. +`commitlint` is considered stable and is used in various projects as development tool. We identify **ease of adoption** and **developer experience** as fields where there is room and need for improvement. The items on the roadmap should enhance `commitlint` regarding those aspects. -* [x] **Adoption**: Provide reusable Travis CI integration: `@commitlint/travis-cli` (https://github.com/conventional-changelog/commitlint/releases/tag/v5.1.0) -* [ ] **DX**: Support PR squash scenario via [ahmed-taj/commitlint-bot](https://github.com/ahmed-taj/commitlint-bot/) and `@commitlint/travis-cli` -* [ ] **Adoption**: Make [ahmed-taj/commitlint-bot](https://github.com/ahmed-taj/commitlint-bot/) configurable via `commitlint` configuration -* [ ] **Adoption**: Create `commitlint init` -* [ ] **DX**: Extend the configuration schema to allow for additional fields (descriptions, examples, fixes) on both the rule and value level -* [ ] **DX**: Incorporate an extended version of [lennym/commit-template](https://github.com/lennym/commit-template) deducing a template from commitlint configuration -* [ ] **DX**: Rewrite `@commitlint/prompt` for better usability (might involve a lot of yak-shaving) +- [x] **Adoption**: Provide reusable Travis CI integration: `@commitlint/travis-cli` (https://github.com/conventional-changelog/commitlint/releases/tag/v5.1.0) +- [ ] **DX**: Support PR squash scenario via [ahmed-taj/commitlint-bot](https://github.com/ahmed-taj/commitlint-bot/) and `@commitlint/travis-cli` +- [ ] **Adoption**: Make [ahmed-taj/commitlint-bot](https://github.com/ahmed-taj/commitlint-bot/) configurable via `commitlint` configuration +- [ ] **Adoption**: Create `commitlint init` +- [ ] **DX**: Extend the configuration schema to allow for additional fields (descriptions, examples, fixes) on both the rule and value level +- [ ] **DX**: Incorporate an extended version of [lennym/commit-template](https://github.com/lennym/commit-template) deducing a template from commitlint configuration +- [ ] **DX**: Rewrite `@commitlint/prompt` for better usability (might involve a lot of yak-shaving) ## Version Support -* Node.js [LTS](https://github.com/nodejs/LTS#lts-schedule) `>= 6` -* git `>= 2.13.2` +- Node.js [LTS](https://github.com/nodejs/LTS#lts-schedule) `>= 6` +- git `>= 2.13.2` ## Related projects -* [conventional-changelog](https://git.io/v18sw) – Generate a changelog from conventional commit history -* [commitizen](https://git.io/vwTym) – Simple commit conventions for internet citizens -* [create-semantic-module](https://git.io/vFjFg) – CLI for quickly integrating commitizen and commitlint in new or existing projects -* [commitlint.io](https://github.com/tomasen/commitlintio) - helps your project to ensures nice and tidy commit messages without needing any download or installation +- [conventional-changelog](https://git.io/v18sw) – Generate a changelog from conventional commit history +- [commitizen](https://git.io/vwTym) – Simple commit conventions for internet citizens +- [create-semantic-module](https://git.io/vFjFg) – CLI for quickly integrating commitizen and commitlint in new or existing projects +- [commitlint.io](https://github.com/tomasen/commitlintio) - helps your project to ensures nice and tidy commit messages without needing any download or installation ## License + Copyright by @marionebl. All `commitlint` packages are released under the MIT license. ## Development @@ -205,20 +211,18 @@ yarn test yarn run publish ``` - [0]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square [1]: https://nodejs.org/api/documentation.html#documentation_stability_index [2]: https://img.shields.io/npm/v/@commitlint/cli.svg?style=flat-square [3]: https://npmjs.org/package/@commitlint/cli [4]: https://img.shields.io/circleci/project/github/conventional-changelog/commitlint/master.svg?style=flat-square [5]: https://circleci.com/gh/conventional-changelog/commitlint + [8]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square [9]: https://nodejs.org/api/documentation.html#documentation_stability_index - [10]: https://img.shields.io/npm/v/@commitlint/cli/next.svg?style=flat-square - [11]: https://devtoolscommunity.herokuapp.com/badge.svg?style=flat-square [12]: https://devtoolscommunity.herokuapp.com diff --git a/docker-compose.yml b/docker-compose.yml index 7f82523ed3..5e57122d7a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,15 +1,14 @@ -version: "3" +version: '3' services: commitlint: build: . image: marionebl/commitlint-cubicle ports: - - "8443:8443" + - '8443:8443' environment: - SSH_AUTH_SOCK=/.ssh-agent/socket - SSH_AUTH_PROXY_SOCK=/.ssh-agent/proxy-socket volumes: - .:/root/repo - $SSH_AUTH_SOCK:/.ssh-agent/socket - command: code-server --no-auth /root/repo - + command: code-server --no-auth /root/repo diff --git a/docs/README.md b/docs/README.md index 679aa880ac..98fac07463 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,7 +4,7 @@ -> Demo generated with [svg-term-cli](https://github.com/marionebl/svg-term-cli) +> Demo generated with [svg-term-cli](https://github.com/marionebl/svg-term-cli) # commitlint   [![slack][11]][12] @@ -43,20 +43,19 @@ echo 'foo: bar' | commitlint commitlint --from=HEAD~1 ``` - ?> To get the most out of `commitlint` you'll want to automate it in your project lifecycle. See our [Local setup guide](./guides-local-setup.md?id=guides-local-setup) for next steps. ## Documentation -* **Guides** - Common use cases explained in a step-by-step pace -* **Concepts** - Overarching topics important to understand the use of `commitlint` -* **Reference** - Mostly technical documentation +- **Guides** - Common use cases explained in a step-by-step pace +- **Concepts** - Overarching topics important to understand the use of `commitlint` +- **Reference** - Mostly technical documentation ## Attributions -* `commitlint` is possible because of the hard work of the folks of the `conventional-changelog` project -* Thanks [@markusoelhafen](https://github.com/markusoelhafen) for providing -the `commitlint` icon +- `commitlint` is possible because of the hard work of the folks of the `conventional-changelog` project +- Thanks [@markusoelhafen](https://github.com/markusoelhafen) for providing + the `commitlint` icon [0]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square [1]: https://nodejs.org/api/documentation.html#documentation_stability_index @@ -64,13 +63,12 @@ the `commitlint` icon [3]: https://npmjs.org/package/@commitlint/cli [4]: https://img.shields.io/circleci/project/github/conventional-changelog/commitlint/master.svg?style=flat-square [5]: https://circleci.com/gh/conventional-changelog/commitlint + [8]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square [9]: https://nodejs.org/api/documentation.html#documentation_stability_index - [10]: https://img.shields.io/npm/v/@commitlint/cli/next.svg?style=flat-square - [11]: http://devtoolscommunity.herokuapp.com/badge.svg?style=flat-square [12]: http://devtoolscommunity.herokuapp.com diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 95328b19e7..d112ec0536 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,17 +1,19 @@ -* **Guides** - * [Local setup](guides-local-setup.md) - * [CI setup](guides-ci-setup.md) - * [Use prompt](guides-use-prompt.md) - * [Upgrade commitlint](guides-upgrade.md) +- **Guides** -* **Concepts** - * [Commit conventions](concepts-commit-conventions) - * [Shareable configuration](concepts-shareable-config.md) + - [Local setup](guides-local-setup.md) + - [CI setup](guides-ci-setup.md) + - [Use prompt](guides-use-prompt.md) + - [Upgrade commitlint](guides-upgrade.md) -* **Reference** - * [CLI](reference-cli.md) - * [Configuration](reference-configuration.md) - * [Rules](reference-rules.md) - * [API](reference-api.md) - * [Plugins](reference-plugins.md) - * [Examples](reference-examples.md) +- **Concepts** + + - [Commit conventions](concepts-commit-conventions) + - [Shareable configuration](concepts-shareable-config.md) + +- **Reference** + - [CLI](reference-cli.md) + - [Configuration](reference-configuration.md) + - [Rules](reference-rules.md) + - [API](reference-api.md) + - [Plugins](reference-plugins.md) + - [Examples](reference-examples.md) diff --git a/docs/assets/commitlint.json b/docs/assets/commitlint.json index cc477cf55f..e1110e8bf1 100644 --- a/docs/assets/commitlint.json +++ b/docs/assets/commitlint.json @@ -14,26 +14,11 @@ 0.043582, "\u001b[1m\u001b[30m⏎\u001b[0;10m \r⏎ \r\u001b[2K\u001b[34m~/Projects/labs/commitlint\u001b[30m\u001b[0;10m \u001b[90mmaster*\u001b[30m\u001b[0;10m\t\u001b[36m\u001b[30m\u001b[0;10m\r\n\u001b[32m❯\u001b[30m\u001b[0;10m \u001b[K" ], - [ - 1.424417, - "e" - ], - [ - 0.000242, - "\u001b[D\u001b[31m\u001b[1me\u001b[0;10m" - ], - [ - 0.007262, - "\u001b[33masy_install \u001b[12D\u001b[30m\u001b[0;10m" - ], - [ - 0.088508, - "\u001b[31m\u001b[1mc\u001b[0;10m\u001b[K" - ], - [ - 0.005534, - "\u001b[33mho \u001b[3D\u001b[30m\u001b[0;10m" - ], + [1.424417, "e"], + [0.000242, "\u001b[D\u001b[31m\u001b[1me\u001b[0;10m"], + [0.007262, "\u001b[33masy_install \u001b[12D\u001b[30m\u001b[0;10m"], + [0.088508, "\u001b[31m\u001b[1mc\u001b[0;10m\u001b[K"], + [0.005534, "\u001b[33mho \u001b[3D\u001b[30m\u001b[0;10m"], [ 0.074302, "\u001b[31m\u001b[1mh\u001b[0;10m\u001b[33mo \u001b[D\u001b[D\u001b[30m\u001b[0;10m" @@ -46,94 +31,28 @@ 0.000271, "\u001b[4D\u001b[35mecho\u001b[33m \u001b[D\u001b[30m\u001b[0;10m" ], - [ - 0.175855, - "\u001b[35m \u001b[30m\u001b[0;10m" - ], - [ - 0.00018, - "\u001b[D " - ], - [ - 0.159886, - "\"" - ], - [ - 0.000155, - "\u001b[D\u001b[31m\u001b[1m\"\u001b[0;10m" - ], - [ - 0.519818, - "\u001b[31m\u001b[1mf\u001b[0;10m" - ], - [ - 0.080105, - "\u001b[31m\u001b[1mo\u001b[0;10m" - ], - [ - 0.159857, - "\u001b[31m\u001b[1mo\u001b[0;10m" - ], - [ - 0.176008, - "\u001b[31m\u001b[1m\"\u001b[0;10m" - ], - [ - 0.000288, - "\u001b[5D\u001b[33m\"foo\"\u001b[30m\u001b[0;10m" - ], - [ - 0.503731, - "\u001b[33m \u001b[30m\u001b[0;10m" - ], - [ - 0.000264, - "\u001b[D " - ], - [ - 0.287853, - "|" - ], - [ - 0.000198, - "\u001b[D\u001b[32m|\u001b[30m\u001b[0;10m" - ], - [ - 0.239819, - "\u001b[32m \u001b[30m\u001b[0;10m" - ], - [ - 0.000253, - "\u001b[D " - ], - [ - 1.35986, - "c" - ], - [ - 0.000264, - "\u001b[D\u001b[31m\u001b[1mc\u001b[0;10m" - ], - [ - 0.011992, - "\u001b[33m++ \u001b[3D\u001b[30m\u001b[0;10m" - ], - [ - 0.059653, - "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[K" - ], - [ - 0.007052, - "\u001b[33mde \u001b[3D\u001b[30m\u001b[0;10m" - ], - [ - 0.072258, - "\u001b[31m\u001b[1mm\u001b[0;10m\u001b[K" - ], - [ - 0.005423, - "\u001b[33mm \u001b[D\u001b[D\u001b[30m\u001b[0;10m" - ], + [0.175855, "\u001b[35m \u001b[30m\u001b[0;10m"], + [0.00018, "\u001b[D "], + [0.159886, "\""], + [0.000155, "\u001b[D\u001b[31m\u001b[1m\"\u001b[0;10m"], + [0.519818, "\u001b[31m\u001b[1mf\u001b[0;10m"], + [0.080105, "\u001b[31m\u001b[1mo\u001b[0;10m"], + [0.159857, "\u001b[31m\u001b[1mo\u001b[0;10m"], + [0.176008, "\u001b[31m\u001b[1m\"\u001b[0;10m"], + [0.000288, "\u001b[5D\u001b[33m\"foo\"\u001b[30m\u001b[0;10m"], + [0.503731, "\u001b[33m \u001b[30m\u001b[0;10m"], + [0.000264, "\u001b[D "], + [0.287853, "|"], + [0.000198, "\u001b[D\u001b[32m|\u001b[30m\u001b[0;10m"], + [0.239819, "\u001b[32m \u001b[30m\u001b[0;10m"], + [0.000253, "\u001b[D "], + [1.35986, "c"], + [0.000264, "\u001b[D\u001b[31m\u001b[1mc\u001b[0;10m"], + [0.011992, "\u001b[33m++ \u001b[3D\u001b[30m\u001b[0;10m"], + [0.059653, "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[K"], + [0.007052, "\u001b[33mde \u001b[3D\u001b[30m\u001b[0;10m"], + [0.072258, "\u001b[31m\u001b[1mm\u001b[0;10m\u001b[K"], + [0.005423, "\u001b[33mm \u001b[D\u001b[D\u001b[30m\u001b[0;10m"], [ 0.107004, "\u001b[31m\u001b[1mm\u001b[0;10m\u001b[33m \u001b[D\u001b[30m\u001b[0;10m" @@ -142,30 +61,15 @@ 0.000313, "\u001b[4D\u001b[35mcomm\u001b[33m \u001b[D\u001b[30m\u001b[0;10m" ], - [ - 0.175907, - "\u001b[35mi\u001b[30m\u001b[0;10m" - ], - [ - 0.000305, - "\u001b[5D\u001b[31m\u001b[1mcommi\u001b[0;10m" - ], - [ - 0.005943, - "\u001b[33mtizen \u001b[6D\u001b[30m\u001b[0;10m" - ], + [0.175907, "\u001b[35mi\u001b[30m\u001b[0;10m"], + [0.000305, "\u001b[5D\u001b[31m\u001b[1mcommi\u001b[0;10m"], + [0.005943, "\u001b[33mtizen \u001b[6D\u001b[30m\u001b[0;10m"], [ 0.073589, "\u001b[31m\u001b[1mt\u001b[0;10m\u001b[33mizen \u001b[5D\u001b[30m\u001b[0;10m" ], - [ - 0.120186, - "\u001b[31m\u001b[1ml\u001b[0;10m\u001b[K" - ], - [ - 0.005786, - "\u001b[33mint \u001b[4D\u001b[30m\u001b[0;10m" - ], + [0.120186, "\u001b[31m\u001b[1ml\u001b[0;10m\u001b[K"], + [0.005786, "\u001b[33mint \u001b[4D\u001b[30m\u001b[0;10m"], [ 0.20203, "\u001b[31m\u001b[1mi\u001b[0;10m\u001b[33mnt \u001b[3D\u001b[30m\u001b[0;10m" @@ -182,18 +86,9 @@ 0.000346, "\u001b[10D\u001b[35mcommitlint\u001b[33m \u001b[D\u001b[30m\u001b[0;10m" ], - [ - 0.182852, - "\u001b[K\r\n" - ], - [ - 5.5e-05, - "\u001b[30m\u001b[0;10m" - ], - [ - 1.177726, - "\u001b[90m⧗\u001b[39m input: \u001b[1mfoo\u001b[22m\r\n" - ], + [0.182852, "\u001b[K\r\n"], + [5.5e-5, "\u001b[30m\u001b[0;10m"], + [1.177726, "\u001b[90m⧗\u001b[39m input: \u001b[1mfoo\u001b[22m\r\n"], [ 0.000414, "\u001b[31m✖\u001b[39m message may not be empty \u001b[90m[subject-empty]\u001b[39m\r\n\u001b[31m✖\u001b[39m type may not be empty \u001b[90m[type-empty]\u001b[39m\r\n\u001b[1m\u001b[31m✖\u001b[39m found 2 problems, 0 warnings\u001b[22m\r\n" @@ -203,17 +98,11 @@ "\u001b[1m\u001b[30m⏎\u001b[0;10m \r⏎ \r\u001b[2K" ], [ - 8.1e-05, + 8.1e-5, "\r\n\u001b[34m~/Projects/labs/commitlint\u001b[30m\u001b[0;10m \u001b[33m\u001b[30m\u001b[0;10m\u001b[90mmaster*\u001b[30m\u001b[0;10m\t\u001b[36m\u001b[30m\u001b[0;10m\r\n\u001b[31m❯\u001b[30m\u001b[0;10m \u001b[K" ], - [ - 1.780014, - "e" - ], - [ - 0.000274, - "\u001b[D\u001b[31m\u001b[1me\u001b[0;10m" - ], + [1.780014, "e"], + [0.000274, "\u001b[D\u001b[31m\u001b[1me\u001b[0;10m"], [ 0.000377, "\u001b[33mcho \"foo\" | commitlint\u001b[22D\u001b[30m\u001b[0;10m" @@ -250,34 +139,16 @@ 0.000345, "\u001b[D\u001b[31m\u001b[1m\"\u001b[0;10m\u001b[33mfoo\" | commitlint\u001b[17D\u001b[30m\u001b[0;10m" ], - [ - 1.439497, - "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[K" - ], - [ - 0.495237, - "\u001b[D\u001b[K" - ], - [ - 0.136897, - "\u001b[31m\u001b[1mc\u001b[0;10m" - ], + [1.439497, "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[K"], + [0.495237, "\u001b[D\u001b[K"], + [0.136897, "\u001b[31m\u001b[1mc\u001b[0;10m"], [ 0.000689, "\u001b[33mommitlint.config.js\" \u001b[21D\u001b[30m\u001b[0;10m" ], - [ - 0.56659, - "\u001b[D\u001b[K" - ], - [ - 0.097083, - "\u001b[31m\u001b[1mf\u001b[0;10m" - ], - [ - 0.0004, - "\u001b[33moo\" | commitlint\u001b[16D\u001b[30m\u001b[0;10m" - ], + [0.56659, "\u001b[D\u001b[K"], + [0.097083, "\u001b[31m\u001b[1mf\u001b[0;10m"], + [0.0004, "\u001b[33moo\" | commitlint\u001b[16D\u001b[30m\u001b[0;10m"], [ 0.127229, "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[33mo\" | commitlint\u001b[15D\u001b[30m\u001b[0;10m" @@ -286,90 +157,27 @@ 0.13611, "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[33m\" | commitlint\u001b[14D\u001b[30m\u001b[0;10m" ], - [ - 0.312225, - "\u001b[31m\u001b[1m:\u001b[0;10m\u001b[K" - ], - [ - 0.000715, - "\u001b[33m@commitlint/\u001b[12D\u001b[30m\u001b[0;10m" - ], - [ - 0.26294, - "\u001b[31m\u001b[1m \u001b[0;10m\u001b[K" - ], - [ - 0.272129, - "\u001b[31m\u001b[1mb\u001b[0;10m" - ], - [ - 0.088036, - "\u001b[31m\u001b[1ma\u001b[0;10m" - ], - [ - 0.079995, - "\u001b[31m\u001b[1mr\u001b[0;10m" - ], - [ - 0.35253, - "\u001b[31m\u001b[1m\"\u001b[0;10m" - ], - [ - 0.000435, - "\u001b[10D\u001b[33m\"foo: bar\"\u001b[30m\u001b[0;10m" - ], - [ - 0.327106, - "\u001b[33m \u001b[30m\u001b[0;10m" - ], - [ - 0.000283, - "\u001b[D " - ], - [ - 0.31973, - "|" - ], - [ - 0.000223, - "\u001b[D\u001b[32m|\u001b[30m\u001b[0;10m" - ], - [ - 0.263799, - "\u001b[32m \u001b[30m\u001b[0;10m" - ], - [ - 0.000219, - "\u001b[D " - ], - [ - 0.415723, - "c" - ], - [ - 0.000306, - "\u001b[D\u001b[31m\u001b[1mc\u001b[0;10m" - ], - [ - 0.011346, - "\u001b[33m++ \u001b[3D\u001b[30m\u001b[0;10m" - ], - [ - 0.052215, - "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[K" - ], - [ - 0.006604, - "\u001b[33mde \u001b[3D\u001b[30m\u001b[0;10m" - ], - [ - 0.065406, - "\u001b[31m\u001b[1mm\u001b[0;10m\u001b[K" - ], - [ - 0.005895, - "\u001b[33mm \u001b[D\u001b[D\u001b[30m\u001b[0;10m" - ], + [0.312225, "\u001b[31m\u001b[1m:\u001b[0;10m\u001b[K"], + [0.000715, "\u001b[33m@commitlint/\u001b[12D\u001b[30m\u001b[0;10m"], + [0.26294, "\u001b[31m\u001b[1m \u001b[0;10m\u001b[K"], + [0.272129, "\u001b[31m\u001b[1mb\u001b[0;10m"], + [0.088036, "\u001b[31m\u001b[1ma\u001b[0;10m"], + [0.079995, "\u001b[31m\u001b[1mr\u001b[0;10m"], + [0.35253, "\u001b[31m\u001b[1m\"\u001b[0;10m"], + [0.000435, "\u001b[10D\u001b[33m\"foo: bar\"\u001b[30m\u001b[0;10m"], + [0.327106, "\u001b[33m \u001b[30m\u001b[0;10m"], + [0.000283, "\u001b[D "], + [0.31973, "|"], + [0.000223, "\u001b[D\u001b[32m|\u001b[30m\u001b[0;10m"], + [0.263799, "\u001b[32m \u001b[30m\u001b[0;10m"], + [0.000219, "\u001b[D "], + [0.415723, "c"], + [0.000306, "\u001b[D\u001b[31m\u001b[1mc\u001b[0;10m"], + [0.011346, "\u001b[33m++ \u001b[3D\u001b[30m\u001b[0;10m"], + [0.052215, "\u001b[31m\u001b[1mo\u001b[0;10m\u001b[K"], + [0.006604, "\u001b[33mde \u001b[3D\u001b[30m\u001b[0;10m"], + [0.065406, "\u001b[31m\u001b[1mm\u001b[0;10m\u001b[K"], + [0.005895, "\u001b[33mm \u001b[D\u001b[D\u001b[30m\u001b[0;10m"], [ 0.17011, "\u001b[31m\u001b[1mm\u001b[0;10m\u001b[33m \u001b[D\u001b[30m\u001b[0;10m" @@ -378,30 +186,15 @@ 0.000278, "\u001b[4D\u001b[35mcomm\u001b[33m \u001b[D\u001b[30m\u001b[0;10m" ], - [ - 0.439713, - "\u001b[35mi\u001b[30m\u001b[0;10m" - ], - [ - 0.000324, - "\u001b[5D\u001b[31m\u001b[1mcommi\u001b[0;10m" - ], - [ - 0.005334, - "\u001b[33mtizen \u001b[6D\u001b[30m\u001b[0;10m" - ], + [0.439713, "\u001b[35mi\u001b[30m\u001b[0;10m"], + [0.000324, "\u001b[5D\u001b[31m\u001b[1mcommi\u001b[0;10m"], + [0.005334, "\u001b[33mtizen \u001b[6D\u001b[30m\u001b[0;10m"], [ 0.114637, "\u001b[31m\u001b[1mt\u001b[0;10m\u001b[33mizen \u001b[5D\u001b[30m\u001b[0;10m" ], - [ - 0.120005, - "\u001b[31m\u001b[1ml\u001b[0;10m\u001b[K" - ], - [ - 0.005761, - "\u001b[33mint \u001b[4D\u001b[30m\u001b[0;10m" - ], + [0.120005, "\u001b[31m\u001b[1ml\u001b[0;10m\u001b[K"], + [0.005761, "\u001b[33mint \u001b[4D\u001b[30m\u001b[0;10m"], [ 0.16208, "\u001b[31m\u001b[1mi\u001b[0;10m\u001b[33mnt \u001b[3D\u001b[30m\u001b[0;10m" @@ -418,10 +211,7 @@ 0.000335, "\u001b[10D\u001b[35mcommitlint\u001b[33m \u001b[D\u001b[30m\u001b[0;10m" ], - [ - 0.686938, - "\u001b[K\r\n\u001b[30m\u001b[0;10m" - ], + [0.686938, "\u001b[K\r\n\u001b[30m\u001b[0;10m"], [ 1.179442, "\u001b[90m⧗\u001b[39m input: \u001b[1mfoo: bar\u001b[22m\r\n" @@ -435,93 +225,33 @@ "\u001b[1m\u001b[30m⏎\u001b[0;10m \r⏎ \r\u001b[2K" ], [ - 3.9e-05, + 3.9e-5, "\r\n\u001b[34m~/Projects/labs/commitlint\u001b[30m\u001b[0;10m \u001b[33m\u001b[30m\u001b[0;10m\u001b[90mmaster*\u001b[30m\u001b[0;10m\t\u001b[36m\u001b[30m\u001b[0;10m\r\n\u001b[31m❯\u001b[30m\u001b[0;10m \u001b[K" ], - [ - 0.45916, - "echo \"foo: bar\" | commitlint" - ], + [0.45916, "echo \"foo: bar\" | commitlint"], [ 0.000339, "\u001b[28D\u001b[35mecho\u001b[30m\u001b[0;10m \u001b[33m\"foo: bar\"\u001b[30m\u001b[0;10m \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[30m\u001b[0;10m" ], - [ - 0.246219, - "\u001b[D" - ], - [ - 0.502613, - "\u001b[D" - ], - [ - 0.088524, - "\u001b[D" - ], - [ - 0.087414, - "\u001b[D" - ], - [ - 0.088208, - "\u001b[D" - ], - [ - 0.083942, - "\u001b[D" - ], - [ - 0.083394, - "\u001b[D" - ], - [ - 0.08431, - "\u001b[D" - ], - [ - 0.088025, - "\u001b[D" - ], - [ - 0.088327, - "\u001b[D" - ], - [ - 0.087976, - "\u001b[D" - ], - [ - 0.084932, - "\u001b[D" - ], - [ - 0.083834, - "\u001b[D" - ], - [ - 0.086017, - "\u001b[D" - ], - [ - 0.088395, - "\u001b[D" - ], - [ - 0.088266, - "\u001b[D" - ], - [ - 0.087041, - "\u001b[D" - ], - [ - 0.083235, - "\u001b[D" - ], - [ - 0.219576, - "\u001b[D" - ], + [0.246219, "\u001b[D"], + [0.502613, "\u001b[D"], + [0.088524, "\u001b[D"], + [0.087414, "\u001b[D"], + [0.088208, "\u001b[D"], + [0.083942, "\u001b[D"], + [0.083394, "\u001b[D"], + [0.08431, "\u001b[D"], + [0.088025, "\u001b[D"], + [0.088327, "\u001b[D"], + [0.087976, "\u001b[D"], + [0.084932, "\u001b[D"], + [0.083834, "\u001b[D"], + [0.086017, "\u001b[D"], + [0.088395, "\u001b[D"], + [0.088266, "\u001b[D"], + [0.087041, "\u001b[D"], + [0.083235, "\u001b[D"], + [0.219576, "\u001b[D"], [ 0.527938, "\u001b[D\u001b[33m: bar\" \u001b[30m\u001b[0;10m|\u001b[32m \u001b[30m\u001b[0;10mc\u001b[35mommitlint\u001b[30m\u001b[0;10m\u001b[K\u001b[19D" @@ -602,10 +332,7 @@ 0.000667, "\u001b[5C\u001b[33m\"\u001b[30m\u001b[0;10m \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[19D\u001b[30m\u001b[0;10m" ], - [ - 0.382519, - "\u001b[D" - ], + [0.382519, "\u001b[D"], [ 0.128976, "\u001b[33ms): bar\u001b[30m\u001b[0;10m\"\u001b[32m \u001b[30m\u001b[0;10m|\u001b[35m commitlint\u001b[20D\u001b[30m\u001b[0;10m" @@ -646,30 +373,12 @@ 0.00047, "\u001b[6C\u001b[33m\"\u001b[30m\u001b[0;10m \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[20D\u001b[30m\u001b[0;10m" ], - [ - 0.174646, - "\u001b[C" - ], - [ - 0.160014, - "\u001b[C" - ], - [ - 0.144159, - "\u001b[C" - ], - [ - 0.151878, - "\u001b[C" - ], - [ - 0.15203, - "\u001b[C" - ], - [ - 0.751957, - "\u001b[C" - ], + [0.174646, "\u001b[C"], + [0.160014, "\u001b[C"], + [0.144159, "\u001b[C"], + [0.151878, "\u001b[C"], + [0.15203, "\u001b[C"], + [0.751957, "\u001b[C"], [ 0.296238, "\u001b[D\u001b[33m\" \u001b[30m\u001b[0;10m|\u001b[32m \u001b[30m\u001b[0;10mc\u001b[35mommitlint\u001b[30m\u001b[0;10m\u001b[K\u001b[14D" @@ -742,10 +451,7 @@ 0.000641, "\u001b[33m\"\u001b[30m\u001b[0;10m \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[14D\u001b[30m\u001b[0;10m" ], - [ - 0.190361, - "\u001b[14C\r\n\u001b[30m\u001b[0;10m" - ], + [0.190361, "\u001b[14C\r\n\u001b[30m\u001b[0;10m"], [ 1.170189, "\u001b[90m⧗\u001b[39m input: \u001b[1mchore(scope): messag\u001b[22m\r\n" @@ -762,106 +468,34 @@ 0.000104, "\r\n\u001b[34m~/Projects/labs/commitlint\u001b[30m\u001b[0;10m \u001b[33m\u001b[30m\u001b[0;10m\u001b[90mmaster*\u001b[30m\u001b[0;10m\t\u001b[36m\u001b[30m\u001b[0;10m\r\n\u001b[31m❯\u001b[30m\u001b[0;10m \u001b[K" ], - [ - 1.595015, - "echo \"chore(scope): messag\" | commitlint" - ], + [1.595015, "echo \"chore(scope): messag\" | commitlint"], [ 0.00045, "\u001b[40D\u001b[35mecho\u001b[30m\u001b[0;10m \u001b[33m\"chore(scope): messag\"\u001b[30m\u001b[0;10m \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[30m\u001b[0;10m" ], - [ - 0.41445, - "\u001b[D" - ], - [ - 0.503174, - "\u001b[D" - ], - [ - 0.08644, - "\u001b[D" - ], - [ - 0.08346, - "\u001b[D" - ], - [ - 0.087163, - "\u001b[D" - ], - [ - 0.084405, - "\u001b[D" - ], - [ - 0.085425, - "\u001b[D" - ], - [ - 0.084549, - "\u001b[D" - ], - [ - 0.083284, - "\u001b[D" - ], - [ - 0.083372, - "\u001b[D" - ], - [ - 0.083362, - "\u001b[D" - ], - [ - 0.083392, - "\u001b[D" - ], - [ - 0.088245, - "\u001b[D" - ], - [ - 0.085091, - "\u001b[D" - ], - [ - 0.084852, - "\u001b[D" - ], - [ - 0.087872, - "\u001b[D" - ], - [ - 0.087465, - "\u001b[D" - ], - [ - 0.083365, - "\u001b[D" - ], - [ - 0.088288, - "\u001b[D" - ], - [ - 0.088374, - "\u001b[D" - ], - [ - 0.086046, - "\u001b[D" - ], - [ - 0.656623, - "\u001b[D" - ], - [ - 0.711983, - "\u001b[D" - ], + [0.41445, "\u001b[D"], + [0.503174, "\u001b[D"], + [0.08644, "\u001b[D"], + [0.08346, "\u001b[D"], + [0.087163, "\u001b[D"], + [0.084405, "\u001b[D"], + [0.085425, "\u001b[D"], + [0.084549, "\u001b[D"], + [0.083284, "\u001b[D"], + [0.083372, "\u001b[D"], + [0.083362, "\u001b[D"], + [0.083392, "\u001b[D"], + [0.088245, "\u001b[D"], + [0.085091, "\u001b[D"], + [0.084852, "\u001b[D"], + [0.087872, "\u001b[D"], + [0.087465, "\u001b[D"], + [0.083365, "\u001b[D"], + [0.088288, "\u001b[D"], + [0.088374, "\u001b[D"], + [0.086046, "\u001b[D"], + [0.656623, "\u001b[D"], + [0.711983, "\u001b[D"], [ 0.42408, "\u001b[D\u001b[33m): messag\" \u001b[30m\u001b[0;10m|\u001b[32m \u001b[30m\u001b[0;10mc\u001b[35mommitlint\u001b[30m\u001b[0;10m\u001b[K\u001b[23D" @@ -902,10 +536,7 @@ 0.000218, "\u001b[10C \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[23D\u001b[30m\u001b[0;10m" ], - [ - 1.495663, - "\u001b[C" - ], + [1.495663, "\u001b[C"], [ 0.320133, "\u001b[D\u001b[33m: messag\" \u001b[30m\u001b[0;10m|\u001b[32m \u001b[30m\u001b[0;10mc\u001b[35mommitlint\u001b[30m\u001b[0;10m\u001b[K\u001b[22D" @@ -922,38 +553,14 @@ 0.000219, "\u001b[9C \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[22D\u001b[30m\u001b[0;10m" ], - [ - 0.327953, - "\u001b[C" - ], - [ - 0.184011, - "\u001b[C" - ], - [ - 0.167976, - "\u001b[C" - ], - [ - 0.143875, - "\u001b[C" - ], - [ - 0.159963, - "\u001b[C" - ], - [ - 0.151488, - "\u001b[C" - ], - [ - 0.160789, - "\u001b[C" - ], - [ - 0.151846, - "\u001b[C" - ], + [0.327953, "\u001b[C"], + [0.184011, "\u001b[C"], + [0.167976, "\u001b[C"], + [0.143875, "\u001b[C"], + [0.159963, "\u001b[C"], + [0.151488, "\u001b[C"], + [0.160789, "\u001b[C"], + [0.151846, "\u001b[C"], [ 0.184798, "\u001b[33me\u001b[30m\u001b[0;10m\"\u001b[32m \u001b[30m\u001b[0;10m|\u001b[35m commitlint\u001b[14D\u001b[30m\u001b[0;10m" @@ -962,10 +569,7 @@ 0.000621, "\u001b[33m\"\u001b[30m\u001b[0;10m \u001b[32m|\u001b[30m\u001b[0;10m \u001b[35mcommitlint\u001b[14D\u001b[30m\u001b[0;10m" ], - [ - 0.566558, - "\u001b[14C\r\n\u001b[30m\u001b[0;10m" - ], + [0.566558, "\u001b[14C\r\n\u001b[30m\u001b[0;10m"], [ 1.174173, "\u001b[90m⧗\u001b[39m input: \u001b[1mchore: message\u001b[22m\r\n" @@ -974,25 +578,16 @@ 0.000452, "\u001b[1m\u001b[32m✔\u001b[39m found 0 problems, 0 warnings\u001b[22m\r\n" ], - [ - 8.4e-05, - "\r\n" - ], + [8.4e-5, "\r\n"], [ 0.048998, "\u001b[1m\u001b[30m⏎\u001b[0;10m \r⏎ \r\u001b[2K" ], [ - 3.4e-05, + 3.4e-5, "\r\n\u001b[34m~/Projects/labs/commitlint\u001b[30m\u001b[0;10m \u001b[90mmaster*\u001b[30m\u001b[0;10m\t\u001b[36m\u001b[30m\u001b[0;10m\r\n\u001b[32m❯\u001b[30m\u001b[0;10m \u001b[K" ], - [ - 2.345267, - "\r\n\u001b[30m\u001b[0;10m\u001b[30m\u001b[0;1" - ], - [ - 8.2e-05, - "0m" - ] + [2.345267, "\r\n\u001b[30m\u001b[0;10m\u001b[30m\u001b[0;1"], + [8.2e-5, "0m"] ] } diff --git a/docs/concepts-commit-conventions.md b/docs/concepts-commit-conventions.md index 4ead5ee254..067ac7c494 100644 --- a/docs/concepts-commit-conventions.md +++ b/docs/concepts-commit-conventions.md @@ -1,12 +1,12 @@ # Concept: Commit conventions -Commit conventions allow your team to add more semantic meaning to your git history. This e.g. includes `type`, `scope` or `breaking changes`. +Commit conventions allow your team to add more semantic meaning to your git history. This e.g. includes `type`, `scope` or `breaking changes`. With this additional information tools can derive useful human-readable information for releases of your project. Some examples are -* Automated, rich changelogs -* Automatic version bumps -* Filter for test harnesses to run +- Automated, rich changelogs +- Automatic version bumps +- Filter for test harnesses to run The most common commit conventions follow this pattern: diff --git a/docs/concepts-shareable-config.md b/docs/concepts-shareable-config.md index 87fccba4f8..fcf35a80dc 100644 --- a/docs/concepts-shareable-config.md +++ b/docs/concepts-shareable-config.md @@ -30,7 +30,7 @@ You can also load local configuration by using a relative path to the file. // commitlint.config.js module.exports = { extends: ['./example'] // => ./example.js -} +}; ``` ## Scoped packages diff --git a/docs/guides-ci-setup.md b/docs/guides-ci-setup.md index 02ae38ce86..75bda0b07a 100644 --- a/docs/guides-ci-setup.md +++ b/docs/guides-ci-setup.md @@ -2,7 +2,7 @@ Enforce commit conventions with confidence by linting on your CI servers with `commitlint`. -This guide assumes you have a already configured `commitlint` for local usage. +This guide assumes you have a already configured `commitlint` for local usage. Follow the [Getting Started](./?id=getting-started) for basic installation and configuration instructions. diff --git a/docs/guides-local-setup.md b/docs/guides-local-setup.md index c3f6658215..df2f9f8f5d 100644 --- a/docs/guides-local-setup.md +++ b/docs/guides-local-setup.md @@ -36,7 +36,7 @@ This allows us to add [git hooks](https://git-scm.com/docs/githooks) directly in "husky": { "hooks": { "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" - } + } } } ``` @@ -55,7 +55,6 @@ npx commitlint --from HEAD~1 --to HEAD --verbose This will check your last commit and return an error if invalid or a positive output if valid. - ### Test the hook You can test the hook by simply committing. You should see something like this if everything works. diff --git a/docs/guides-upgrade.md b/docs/guides-upgrade.md index d82b35f503..4f7002cd62 100644 --- a/docs/guides-upgrade.md +++ b/docs/guides-upgrade.md @@ -2,7 +2,7 @@ ## validate-commit-msg -The maintainers of [validate-commit-msg](https://github.com/conventional-changelog-archived-repos/validate-commit-msg) have deprecated their package in favor of `commitlint`. +The maintainers of [validate-commit-msg](https://github.com/conventional-changelog-archived-repos/validate-commit-msg) have deprecated their package in favor of `commitlint`. ### Migrating with default settings @@ -67,7 +67,7 @@ module.exports = { // Place your rules here 'scope-enum': [2, 'always', ['a', 'b']] // error if scope is given but not in provided list } -} +}; ``` ### validate-commit-msg option equivalents @@ -94,7 +94,6 @@ Refer to the [Rules Referece](reference-rules.md) for a list of all avaiable con There is also the [#commitlint](https://yargs.slack.com/messages/C7M8XJ4RL/) channel on the DevTools Slack workspace. Join us there and we'll do our best to help you with your migration. - ## Version 1 to 2 ```bash @@ -105,15 +104,15 @@ npm install --save-dev conventional-changelog-lint@latest #### CLI -* None +- None #### Config -* **wildcards** config is ignored - as of version `2.0.0` the former `.wildcards` configuration is ignored entirely. If your `.conventional-changelog-lintrc`, `commitlint.config.js` or an extended shareable configuration has a `.wildcards` key a warning will be issued. +- **wildcards** config is ignored - as of version `2.0.0` the former `.wildcards` configuration is ignored entirely. If your `.conventional-changelog-lintrc`, `commitlint.config.js` or an extended shareable configuration has a `.wildcards` key a warning will be issued. #### API -* None +- None ## Version 2 to 3 @@ -123,29 +122,29 @@ npm install --save commitlint mv .conventional-changelog-lintrc commitlint.config.js ``` -* Rename all calls to `conventional-changelog-lint` to `commitlint` +- Rename all calls to `conventional-changelog-lint` to `commitlint` ### Breaking changes #### CLI -* `conventional-changelog-lint` command now is called `commitlint` -* `commitlint` command now is installed via `@commitlint/cli` -* `.conventional-changelog-lintrc` now is called `commitlint.config.js` -* `commitlint` does not search upwards in the directory structure for config -* `--preset | -p` flag was removed. The `angular` preset is used always. +- `conventional-changelog-lint` command now is called `commitlint` +- `commitlint` command now is installed via `@commitlint/cli` +- `.conventional-changelog-lintrc` now is called `commitlint.config.js` +- `commitlint` does not search upwards in the directory structure for config +- `--preset | -p` flag was removed. The `angular` preset is used always. #### Config -* `.preset` key is removed. The `angular` preset is used always. +- `.preset` key is removed. The `angular` preset is used always. #### API -* `getConfiguration(name, settings, seed)` changed to `load(seed)` -* `getMessages(range)` changed to `read(range)` -* `getPreset(name, require)` removed -* `format(report, options)` now only respects `.color` on `options` -* `lint(message, options)` changed to `lint(message, rules)` +- `getConfiguration(name, settings, seed)` changed to `load(seed)` +- `getMessages(range)` changed to `read(range)` +- `getPreset(name, require)` removed +- `format(report, options)` now only respects `.color` on `options` +- `lint(message, options)` changed to `lint(message, rules)` ## Version 4 to 5 @@ -159,8 +158,8 @@ echo 'module.exports = {extends: ["@commitlint/config-conventional"]};'; #### Config -* `config-angular` dropped support for the `chore` type, breaking compat with conventional-changelog, -use `config-conventional` instead. +- `config-angular` dropped support for the `chore` type, breaking compat with conventional-changelog, + use `config-conventional` instead. ## Version 7 to 8 @@ -168,4 +167,4 @@ use `config-conventional` instead. #### Output on succesful commit will be ommited -* You can use the `--verbose` flag to get positive output +- You can use the `--verbose` flag to get positive output diff --git a/docs/guides-use-prompt.md b/docs/guides-use-prompt.md index 508bef7901..d636020315 100644 --- a/docs/guides-use-prompt.md +++ b/docs/guides-use-prompt.md @@ -36,5 +36,6 @@ npm run commit ``` ## An alternative to `@commitlint/prompt`: commitizen + Another way to author commit messages that adhere to the commit convention configured in `commitlint.config.js` is to use `commitizen`. For more information, checkout their [official website](http://commitizen.github.io/cz-cli/). diff --git a/docs/index.html b/docs/index.html index 7a8e8dab9d..5a6e0e9a20 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,136 +1,140 @@ + + + commitlint - Lint commit messages + + + + + + + - - - commitlint - Lint commit messages - - - - - - - - - -
- - - - - - - - - + +
+ + + + + + + + diff --git a/docs/reference-api.md b/docs/reference-api.md index f4a4749bb0..8fb7a43c00 100644 --- a/docs/reference-api.md +++ b/docs/reference-api.md @@ -4,7 +4,7 @@ > Format commitlint reports -### Install +### Install ``` npm install --save @commitlint/format @@ -12,7 +12,7 @@ npm install --save @commitlint/format ### Usage -* **Signature** +- **Signature** ```ts type Problem = { @@ -49,7 +49,7 @@ type formatOptions = { * Signs to use as decoration for messages with severy 0, 1, 2 **/ signs: readonly [string; string; string] = [' ', '⚠', '✖']; - + /** * Colors to use for messages with severy 0, 1, 2 **/ @@ -69,40 +69,43 @@ type formatOptions = { format(report?: Report = {}, options?: formatOptions = {}) => string[]; ``` -* **Example** +- **Example** ```js const format = require('@commitlint/format'); format(); // => [ '\u001b[1m\u001b[32m✔\u001b[39m found 0 problems, 0 warnings\u001b[22m' ] -format({ - results: [ - { - warnings: [ - { - level: 0, - name: 'some-hint', - message: 'This will not show up as it has level 0' - }, - { - level: 1, - name: 'some-warning', - message: 'This will show up yellow as it has level 1' - } - ], - errors: [ - { - level: 2, - name: 'some-error', - message: 'This will show up red as it has level 2' - } - ] - } - ] -}, { - color: false -}); +format( + { + results: [ + { + warnings: [ + { + level: 0, + name: 'some-hint', + message: 'This will not show up as it has level 0' + }, + { + level: 1, + name: 'some-warning', + message: 'This will show up yellow as it has level 1' + } + ], + errors: [ + { + level: 2, + name: 'some-error', + message: 'This will show up red as it has level 2' + } + ] + } + ] + }, + { + color: false + } +); /* => [ '✖ This will show up red as it has level 2 [some-error]', ' This will not show up as it has level 0 [some-hint]', @@ -115,7 +118,7 @@ format({ > Load shared commitlint configuration -### Install +### Install ``` npm install --save @commitlint/load @@ -123,7 +126,7 @@ npm install --save @commitlint/load ### Usage -* **Signature** +- **Signature** ```ts /** @@ -231,7 +234,7 @@ type LoadOptions = { load(seed: Seed = {}, options?: LoadOptions = {cwd: process.cwd()}) => Promise; ``` -* **Example** +- **Example** ```js const load = require('@commitlint/load'); @@ -240,20 +243,18 @@ load({ rules: { 'body-leading-blank': [2, 'always'] } -}) -.then(config => console.log(config)); +}).then(config => console.log(config)); // => { extends: [], rules: { 'body-leading-blank': [ 2, 'always' ] } } -load({extends: ['./package']}) -.then(config => console.log(config)); +load({extends: ['./package']}).then(config => console.log(config)); // => { extends: ['./package', './package-b'], rules: {} } -load({parserPreset: './parser-preset.js'}) -.then(config => console.log(config)); +load({parserPreset: './parser-preset.js'}).then(config => console.log(config)); // => { extends: [], rules: {}, parserPreset: {name: './parser-preset.js', path: './parser-preset.js', opts: {}}} -load({}, {file: '.commitlintrc.yml', cwd: process.cwd()}) -.then(config => console.log(config)); +load({}, {file: '.commitlintrc.yml', cwd: process.cwd()}).then(config => + console.log(config) +); // => { extends: [], rules: { 'body-leading-blank': [ 1, 'always' ] }, formatter: '@commitlint/format', plugins: {} } ``` @@ -261,7 +262,7 @@ load({}, {file: '.commitlintrc.yml', cwd: process.cwd()}) > Read commit messages from a specified range or disk -### Install +### Install ``` npm install --save @commitlint/read @@ -269,7 +270,7 @@ npm install --save @commitlint/read ### Usage -* **Signature** +- **Signature** ```ts type Range = { @@ -284,26 +285,24 @@ type Range = { read(range: Range) => Promise ``` -* **Example** +- **Example** ```js // git commit -m "I did something" const read = require('@commitlint/read'); -read({edit: true}) - .then(messages => console.log(messages)); +read({edit: true}).then(messages => console.log(messages)); // => ['I did something\n\n'] -read({edit: './git/GITGUI_EDITMESSAGE'}) - .then(messages => console.log(messages)); +read({edit: './git/GITGUI_EDITMESSAGE'}).then(messages => + console.log(messages) +); // => ['I did something via git gui\n\n'] -read({from: 'HEAD~2'}) - .then(messages => console.log(messages)); +read({from: 'HEAD~2'}).then(messages => console.log(messages)); // => ['I did something\n\n', 'Initial commit\n\n'] -read({from: 'HEAD~2', to: 'HEAD~1'}) - .then(messages => console.log(messages)); +read({from: 'HEAD~2', to: 'HEAD~1'}).then(messages => console.log(messages)); // => ['Initial commit\n\n'] ``` @@ -311,7 +310,7 @@ read({from: 'HEAD~2', to: 'HEAD~1'}) > Lint a string against commitlint rules -### Install +### Install ``` npm install --save @commitlint/lint @@ -319,7 +318,7 @@ npm install --save @commitlint/lint ### Usage -* **Signature** +- **Signature** ```ts type RuleLevel = 0 | 1 | 2; @@ -351,22 +350,23 @@ type Options = { lint(message: string, rules: {[ruleName: string]: Rule}, opts?: Options) => Promise; ``` -* **Basic Example** +- **Basic Example** ```js const lint = require('@commitlint/lint'); -lint('foo: bar') - .then(report => console.log(report)); - // => { valid: true, errors: [], warnings: [] } +lint('foo: bar').then(report => console.log(report)); +// => { valid: true, errors: [], warnings: [] } -lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}) - .then(report => console.log(report)); - // => { valid: true, errors: [], warnings: [] } +lint('foo: bar', {'type-enum': [1, 'always', ['foo']]}).then(report => + console.log(report) +); +// => { valid: true, errors: [], warnings: [] } -lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}) - .then(report => console.log(report)); - /* => +lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}).then(report => + console.log(report) +); +/* => { valid: true, errors: [], warnings: @@ -376,13 +376,20 @@ lint('foo: bar', {'type-enum': [1, 'always', ['bar']]}) message: 'type must be one of [bar]' } ] } */ -const opts = {parserOpts: {headerPattern: /^(\w*)-(\w*)/, headerCorrespondence: ['type', 'scope']}}; +const opts = { + parserOpts: { + headerPattern: /^(\w*)-(\w*)/, + headerCorrespondence: ['type', 'scope'] + } +}; -lint('foo-bar', {'type-enum': [2, 'always', ['foo']]}, opts).then(report => console.log(report)); +lint('foo-bar', {'type-enum': [2, 'always', ['foo']]}, opts).then(report => + console.log(report) +); // => { valid: true, errors: [], warnings: [] } ``` -* **Load configuration** +- **Load configuration** ```js const load = require('@commitlint/load'); @@ -393,9 +400,15 @@ const CONFIG = { }; load(CONFIG) - .then(opts => lint('foo: bar', opts.rules, opts.parserPreset ? {parserOpts: opts.parserPreset.parserOpts} : {})) + .then(opts => + lint( + 'foo: bar', + opts.rules, + opts.parserPreset ? {parserOpts: opts.parserPreset.parserOpts} : {} + ) + ) .then(report => console.log(report)); - /* => +/* => { valid: false, errors: [ { level: 2, @@ -406,7 +419,7 @@ load(CONFIG) */ ``` -* **Read git history** +- **Read git history** ```js const lint = require('@commitlint/lint'); @@ -418,11 +431,12 @@ const RULES = { const check = commit => lint(commit, RULES); -read({to: 'HEAD', from: 'HEAD~2'}) - .then(commits => Promise.all(commits.map(check))); +read({to: 'HEAD', from: 'HEAD~2'}).then(commits => + Promise.all(commits.map(check)) +); ``` -* **Simplfied last-commit checker** +- **Simplfied last-commit checker** ```js const load = require('@commitlint/load'); @@ -432,7 +446,11 @@ const lint = require('@commitlint/lint'); Promise.all([load(), read({from: 'HEAD~1'})]) .then(tasks => { const [{rules, parserPreset}, [commit]] = tasks; - return lint(commit, rules, parserPreset ? {parserOpts: parserPreset.parserOpts}: {}); + return lint( + commit, + rules, + parserPreset ? {parserOpts: parserPreset.parserOpts} : {} + ); }) .then(report => console.log(JSON.stringify(result.valid))); ``` diff --git a/docs/reference-configuration.md b/docs/reference-configuration.md index 1e1478e077..4d78c987b4 100644 --- a/docs/reference-configuration.md +++ b/docs/reference-configuration.md @@ -2,72 +2,70 @@ `@commitlint/cli` picks up configuration from `./commitlint.config.js`. -The file is expected +The file is expected -* to contain valid JavaScript -* export a configuration object -* adhere to the schema outlined below +- to contain valid JavaScript +- export a configuration object +- adhere to the schema outlined below ```ts type Config = { - /* - * Resolveable ids to commitlint configurations to extend - */ - extends?: string[]; - /* - * Resolveable id to conventional-changelog parser preset to import and use - */ - parserPreset?: string; - /* - * Resolveable id to package, from node_modules, which formats the output. - */ - formatter: string; - /* - * Rules to check against - */ - rules?: {[name: string]: Rule}; - /* - * Functions that return true if commitlint should ignore the given message. - */ - ignores?: ((message: string) => boolean)[]; - /* - * Whether commitlint uses the default ignore rules. - */ - defaultIgnores?: boolean; -} + /* + * Resolveable ids to commitlint configurations to extend + */ + extends?: string[]; + /* + * Resolveable id to conventional-changelog parser preset to import and use + */ + parserPreset?: string; + /* + * Resolveable id to package, from node_modules, which formats the output. + */ + formatter: string; + /* + * Rules to check against + */ + rules?: {[name: string]: Rule}; + /* + * Functions that return true if commitlint should ignore the given message. + */ + ignores?: ((message: string) => boolean)[]; + /* + * Whether commitlint uses the default ignore rules. + */ + defaultIgnores?: boolean; +}; const Configuration: Config = { - /* - * Resolve and load @commitlint/config-conventional from node_modules. - * Referenced packages must be installed - */ - extends: ['@commitlint/config-conventional'], - /* - * Resolve and load conventional-changelog-atom from node_modules. - * Referenced packages must be installed - */ - parserPreset: 'conventional-changelog-atom', - /* - * Resolve and load @commitlint/format from node_modules. - * Referenced package must be installed - */ - formatter: '@commitlint/format', - /* - * Any rules defined here will override rules from @commitlint/config-conventional - */ - rules: { - 'type-enum': [2, 'always', ['foo']] - }, - /* - * Functions that return true if commitlint should ignore the given message. - */ - ignores: [ - (commit) => commit === '' - ], - /* - * Whether commitlint uses the default ignore rules. - */ - defaultIgnores: true + /* + * Resolve and load @commitlint/config-conventional from node_modules. + * Referenced packages must be installed + */ + extends: ['@commitlint/config-conventional'], + /* + * Resolve and load conventional-changelog-atom from node_modules. + * Referenced packages must be installed + */ + parserPreset: 'conventional-changelog-atom', + /* + * Resolve and load @commitlint/format from node_modules. + * Referenced package must be installed + */ + formatter: '@commitlint/format', + /* + * Any rules defined here will override rules from @commitlint/config-conventional + */ + rules: { + 'type-enum': [2, 'always', ['foo']] + }, + /* + * Functions that return true if commitlint should ignore the given message. + */ + ignores: [commit => commit === ''], + /* + * Whether commitlint uses the default ignore rules. + */ + defaultIgnores: true }; module.exports = Configuration; @@ -76,12 +74,12 @@ module.exports = Configuration; ## Shareable configuration Every commitlint configuration can extend other commitlint configurations. -Specify configurations to extend via the `.extends` key, using ids +Specify configurations to extend via the `.extends` key, using ids that can be resolved by the node resolve algorithm. This means installed npm packages and local files can be used. -* npm +- npm ``` npm install --save-dev commitlint-config-lerna @commitlint/config-conventional @@ -97,41 +95,40 @@ module.exports = { } ``` -* local - +- local ```js // commitlint.config.js module.exports = { - extends: ['./commitlint.base.js', './commitlint.types.js'] -} + extends: ['./commitlint.base.js', './commitlint.types.js'] +}; ``` ```js // commitlint.types.js, will be picked up by commitlint.config.js module.exports = { - rules: { - 'type-enum': [2, 'always', ['foo']] - } -} + rules: { + 'type-enum': [2, 'always', ['foo']] + } +}; ``` ```js // commitlint.base.js, will be picked up by commitlint.config.js module.exports = { - extends: ['@commitlint/config-conventional'], // extends can be nested - parserPreset: 'conventional-changelog-atom' -} + extends: ['@commitlint/config-conventional'], // extends can be nested + parserPreset: 'conventional-changelog-atom' +}; ``` ## Parser presets -The parser preset used to parse commit messages can be configured. +The parser preset used to parse commit messages can be configured. Use ids resolveable by the node resolve algorithm. This means installed npm packages and local files can be used. -* npm +- npm ``` npm install --save-dev conventional-changelog-atom @@ -140,26 +137,26 @@ npm install --save-dev conventional-changelog-atom ```js // commitlint.config.js module.exports = { - parserPreset: 'conventional-changelog-atom' -} + parserPreset: 'conventional-changelog-atom' +}; ``` -* local +- local ```js // commitlint.config.js module.exports = { - parserPreset: './parser-preset' -} + parserPreset: './parser-preset' +}; ``` ```js // parser-preset.js module.exports = { - parserOpts: { - headerPattern: /^(\w*)\((\w*)\)-(\w*)\s(.*)$/, - headerCorrespondence: ['type', 'scope', 'ticket', 'subject'] - } + parserOpts: { + headerPattern: /^(\w*)\((\w*)\)-(\w*)\s(.*)$/, + headerCorrespondence: ['type', 'scope', 'ticket', 'subject'] + } }; ``` @@ -170,7 +167,7 @@ Use ids resolvable by the node resolve algorithm. ```js module.exports = { - formatter: '@commitlint/format' + formatter: '@commitlint/format' }; ``` diff --git a/docs/reference-examples.md b/docs/reference-examples.md index cd6aae28f1..42709982c0 100644 --- a/docs/reference-examples.md +++ b/docs/reference-examples.md @@ -2,14 +2,13 @@ These examples show common usages of how commitlint can be configured. - ## Validate for issue/ticket numbers In your `package.json` add: -```js +``` commitlint: { - 'rules': { + 'rules': { 'references-empty': [2, 'never'], }, parserPreset: { @@ -19,5 +18,3 @@ In your `package.json` add: }, } ``` - - diff --git a/docs/reference-plugins.md b/docs/reference-plugins.md index 3cc83dc139..a5b1bd0b0c 100644 --- a/docs/reference-plugins.md +++ b/docs/reference-plugins.md @@ -9,11 +9,11 @@ Plugins can expose additional rules for use in commitlint. To do so, the plugin ```js module.exports = { - rules: { - "dollar-sign": function(parsed, when, value) { - // rule implementation ... - } + rules: { + 'dollar-sign': function(parsed, when, value) { + // rule implementation ... } + } }; ``` @@ -26,9 +26,9 @@ The plugin support was introduced in commitlint version `7.6.0`. Ensure the `pee ```json { - "peerDependencies": { - "@commitlint/lint": ">=7.6.0" - } + "peerDependencies": { + "@commitlint/lint": ">=7.6.0" + } } ``` @@ -38,11 +38,11 @@ In order to make your plugin available to the community you have to publish it o Recommended keywords: -* `commitlint` -* `commitlintplugin` +- `commitlint` +- `commitlintplugin` Add these keywords into your `package.json` file to make it easy for others to find. ## Further Reading -* [npm Developer Guide](https://docs.npmjs.com/misc/developers) +- [npm Developer Guide](https://docs.npmjs.com/misc/developers) diff --git a/docs/reference-rules.md b/docs/reference-rules.md index 90529a748c..363b39d261 100644 --- a/docs/reference-rules.md +++ b/docs/reference-rules.md @@ -1,361 +1,431 @@ # Rules Rules are made up by a name and a configuration array. The configuration array contains: -* **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. + +- **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. Rule configurations are either of type `array` residing on a key with the rule's name as key on the rules `object` or of type function returning type `array` or `Promise`. This means all of the following notations are supported. **Plain array** -```js + +``` "rules": { "header-max-length": [0, "always", 72], } ``` + **Function returning array** -```js + +``` "rules": { "header-max-length": () => [0, "always", 72], } ``` + **Async function returning array** -```js + +``` "rules": { "header-max-length": async () => [0, "always", 72], } ``` + **Function returning a promise resolving to array** -```js + +``` "rules": { "header-max-length": () => Promise.resolve([0, "always", 72]), } ``` - ### Available rules + #### body-leading-blank -* **condition**: `body` begins with blank line -* **rule**: `always` + +- **condition**: `body` begins with blank line +- **rule**: `always` #### body-max-length -* **condition**: `body` has `value` or less characters -* **rule**: `always` -* **value** -```js - Infinity + +- **condition**: `body` has `value` or less characters +- **rule**: `always` +- **value** + +``` +Infinity ``` #### body-max-line-length -* **condition**: `body` lines has `value` or less characters -* **rule**: `always` -* **value** -```js - Infinity + +- **condition**: `body` lines has `value` or less characters +- **rule**: `always` +- **value** + +``` +Infinity ``` #### body-min-length -* **condition**: `body` has `value` or more characters -* **rule**: `always` -* **value** -```js - 0 + +- **condition**: `body` has `value` or more characters +- **rule**: `always` +- **value** + +``` +0 ``` #### footer-leading-blank -* **condition**: `footer` begins with blank line -* **rule**: `always` + +- **condition**: `footer` begins with blank line +- **rule**: `always` #### footer-max-length -* **condition**: `footer` has `value` or less characters -* **rule**: `always` -* **value** -```js - Infinity + +- **condition**: `footer` has `value` or less characters +- **rule**: `always` +- **value** + +``` +Infinity ``` #### footer-max-line-length -* **condition**: `footer` lines has `value` or less characters -* **rule**: `always` -* **value** -```js - Infinity + +- **condition**: `footer` lines has `value` or less characters +- **rule**: `always` +- **value** + +``` +Infinity ``` #### footer-min-length -* **condition**: `footer` has `value` or more characters -* **rule**: `always` -* **value** -```js - 0 + +- **condition**: `footer` has `value` or more characters +- **rule**: `always` +- **value** + +``` +0 ``` #### header-case -* **condition**: `header` is in case `value` -* **rule**: `always` -```js - 'lowerCase' -``` -* **possible values** -```js - [ - 'lower-case', // default - 'upper-case', // UPPERCASE - 'camel-case', // camelCase - 'kebab-case', // kebab-case - 'pascal-case', // PascalCase - 'sentence-case', // Sentence case - 'snake-case', // snake_case - 'start-case', // Start Case - ] + +- **condition**: `header` is in case `value` +- **rule**: `always` + +``` +'lowerCase' +``` + +- **possible values** + +``` +[ + 'lower-case', // default + 'upper-case', // UPPERCASE + 'camel-case', // camelCase + 'kebab-case', // kebab-case + 'pascal-case', // PascalCase + 'sentence-case', // Sentence case + 'snake-case', // snake_case + 'start-case' // Start Case +] ``` #### header-full-stop -* **condition**: `header` ends with `value` -* **rule**: `never` -* **value** -```js - '.' + +- **condition**: `header` ends with `value` +- **rule**: `never` +- **value** + +``` +'.' ``` #### header-max-length -* **condition**: `header` has `value` or less characters -* **rule**: `always` -* **value** -```js - 72 + +- **condition**: `header` has `value` or less characters +- **rule**: `always` +- **value** + +``` +72 ``` #### header-min-length -* **condition**: `header` has `value` or more characters -* **rule**: `always` -* **value** -```js - 0 + +- **condition**: `header` has `value` or more characters +- **rule**: `always` +- **value** + +``` +0 ``` #### references-empty -* **condition**: `references` has at least one entry -* **rule**: `never` + +- **condition**: `references` has at least one entry +- **rule**: `never` #### scope-enum -* **condition**: `scope` is found in value -* **rule**: `always` -* **value** - ```js - [] + +- **condition**: `scope` is found in value +- **rule**: `always` +- **value** + ``` + [] ``` #### scope-case -* **condition**: `scope` is in case `value` -* **rule**: `always` -```js - 'lowerCase' -``` -* **possible values** -```js - [ - 'lower-case', // default - 'upper-case', // UPPERCASE - 'camel-case', // camelCase - 'kebab-case', // kebab-case - 'pascal-case', // PascalCase - 'sentence-case', // Sentence case - 'snake-case', // snake_case - 'start-case', // Start Case - ] + +- **condition**: `scope` is in case `value` +- **rule**: `always` + +``` +'lowerCase' +``` + +- **possible values** + +``` +[ + 'lower-case', // default + 'upper-case', // UPPERCASE + 'camel-case', // camelCase + 'kebab-case', // kebab-case + 'pascal-case', // PascalCase + 'sentence-case', // Sentence case + 'snake-case', // snake_case + 'start-case' // Start Case +] ``` #### scope-empty -* **condition**: `scope` is empty -* **rule**: `never` + +- **condition**: `scope` is empty +- **rule**: `never` #### scope-max-length -* **condition**: `scope` has `value` or less characters -* **rule**: `always` -* **value** -```js - Infinity + +- **condition**: `scope` has `value` or less characters +- **rule**: `always` +- **value** + +``` +Infinity ``` #### scope-min-length -* **condition**: `scope` has `value` or more characters -* **rule**: `always` -* **value** -```js - 0 + +- **condition**: `scope` has `value` or more characters +- **rule**: `always` +- **value** + +``` +0 ``` #### subject-case -* **condition**: `subject` is in case `value` -* **rule**: `always` -```js - 'lowerCase' -``` -* **possible values** -```js - [ - 'lower-case', // default - 'upper-case', // UPPERCASE - 'camel-case', // camelCase - 'kebab-case', // kebab-case - 'pascal-case', // PascalCase - 'sentence-case', // Sentence case - 'snake-case', // snake_case - 'start-case', // Start Case - ] + +- **condition**: `subject` is in case `value` +- **rule**: `always` + +``` +'lowerCase' +``` + +- **possible values** + +``` +[ + 'lower-case', // default + 'upper-case', // UPPERCASE + 'camel-case', // camelCase + 'kebab-case', // kebab-case + 'pascal-case', // PascalCase + 'sentence-case', // Sentence case + 'snake-case', // snake_case + 'start-case' // Start Case +] ``` #### subject-empty -* **condition**: `subject` is empty -* **rule**: `never` + +- **condition**: `subject` is empty +- **rule**: `never` #### subject-full-stop -* **condition**: `subject` ends with `value` -* **rule**: `never` -* **value** -```js - '.' + +- **condition**: `subject` ends with `value` +- **rule**: `never` +- **value** + +``` +'.' ``` #### subject-max-length -* **condition**: `subject` has `value` or less characters -* **rule**: `always` -* **value** -```js - Infinity + +- **condition**: `subject` has `value` or less characters +- **rule**: `always` +- **value** + +``` +Infinity ``` #### subject-min-length -* **condition**: `subject` has `value` or more characters -* **rule**: `always` -* **value** -```js - 0 + +- **condition**: `subject` has `value` or more characters +- **rule**: `always` +- **value** + +``` +0 ``` #### type-enum -* **condition**: `type` is found in value -* **rule**: `always` -* **value** - ```js - [ - 'feat', - 'fix', - 'docs', - 'style', - 'refactor', - 'test', - 'revert' - ] + +- **condition**: `type` is found in value +- **rule**: `always` +- **value** + ``` + ['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'revert'] ``` #### type-case -* **description**: `type` is in case `value` -* **rule**: `always` -* **value** - ```js - 'lower-case' + +- **description**: `type` is in case `value` +- **rule**: `always` +- **value** + ``` + 'lower-case' ``` -* **possible values** -```js - [ - 'lower-case', // default - 'upper-case', // UPPERCASE - 'camel-case', // camelCase - 'kebab-case', // kebab-case - 'pascal-case', // PascalCase - 'sentence-case', // Sentence case - 'snake-case', // snake_case - 'start-case', // Start Case - ] +- **possible values** + +``` +[ + 'lower-case', // default + 'upper-case', // UPPERCASE + 'camel-case', // camelCase + 'kebab-case', // kebab-case + 'pascal-case', // PascalCase + 'sentence-case', // Sentence case + 'snake-case', // snake_case + 'start-case' // Start Case +]; ``` #### type-empty -* **condition**: `type` is empty -* **rule**: `never` + +- **condition**: `type` is empty +- **rule**: `never` #### type-max-length -* **condition**: `type` has `value` or less characters -* **rule**: `always` -* **value** -```js - Infinity + +- **condition**: `type` has `value` or less characters +- **rule**: `always` +- **value** + +``` +Infinity ``` #### type-min-length -* **condition**: `type` has `value` or more characters -* **rule**: `always` -* **value** -```js - 0 + +- **condition**: `type` has `value` or more characters +- **rule**: `always` +- **value** + +``` +0 ``` #### signed-off-by -* **condition**: `message` has `value` -* **rule**: `always` -* **value** -```js - 'Signed-off-by:' + +- **condition**: `message` has `value` +- **rule**: `always` +- **value** + +``` +'Signed-off-by:' ``` ### Deprecated rules #### body-tense `deprecated` -* **condition**: `body` is verbalized in tense present in `value` -* **rule**: `always` -* **value** -```js - ['present-imperative'] -``` -* **possible values** -```js - [ - 'past-tense', // did - 'present-imperative', // do - 'present-participle', // doing - 'present-third-person' // does - ] + +- **condition**: `body` is verbalized in tense present in `value` +- **rule**: `always` +- **value** + +``` +['present-imperative'] +``` + +- **possible values** + +``` +[ + 'past-tense', // did + 'present-imperative', // do + 'present-participle', // doing + 'present-third-person' // does +] ``` #### footer-tense `deprecated` -* **condition**: `footer` is verbalized in tense present in `value` -* **rule**: `always` -* **value** -```js - ['present-imperative'] -``` -* **possible values** -```js - [ - 'past-tense', // did - 'present-imperative', // do - 'present-participle', // doing - 'present-third-person' // does - ] + +- **condition**: `footer` is verbalized in tense present in `value` +- **rule**: `always` +- **value** + +``` +['present-imperative'] +``` + +- **possible values** + +``` +[ + 'past-tense', // did + 'present-imperative', // do + 'present-participle', // doing + 'present-third-person' // does +] ``` #### lang `deprecated` -* **condition**: `subject` is of language `value` -* **rule**: `always` -* **value** -```js - eng + +- **condition**: `subject` is of language `value` +- **rule**: `always` +- **value** + +``` +eng ``` #### subject-tense `deprecated` -* **condition**: `subject` is verbalized in tense present in `value` -* **rule**: `always` -* **value** -```js - ['present-imperative'] -``` -* **possible values** -```js - [ - 'past-tense', // did - 'present-imperative', // do - 'present-participle', // doing - 'present-third-person' // does - ] + +- **condition**: `subject` is verbalized in tense present in `value` +- **rule**: `always` +- **value** + +``` +['present-imperative'] +``` + +- **possible values** + +``` +[ + 'past-tense', // did + 'present-imperative', // do + 'present-participle', // doing + 'present-third-person' // does +] ``` diff --git a/package.json b/package.json index a7f6daf8bb..31e4d0fb7d 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "deps": "lerna run deps", "pkg": "lerna run pkg", "docs": "docsify serve docs", - "lint": "prettier @{alias,commitlint,packages}/**/*.{ts,js} -l", + "lint": "prettier **/*.{ts,js,json,yml,md} -l", "publish": "lerna publish --conventional-commits", "reinstall": "yarn clean && yarn install", "start": "lerna run start --stream --parallel --include-filtered-dependencies", @@ -26,18 +26,19 @@ ] }, "prettier": { - "useTabs": true, "singleQuote": true, "bracketSpacing": false }, "lint-staged": { - "*.{ts,js}": [ + "*.{ts,js,json,yml,md}": [ "prettier --write" ] }, "renovate": { "rangeStrategy": "update-lockfile", - "ignorePaths": ["**/fixtures/**/package.json"], + "ignorePaths": [ + "**/fixtures/**/package.json" + ], "extends": [ "config:base", ":semanticCommitType(chore)", diff --git a/tsconfig.json b/tsconfig.json index ca6f018b3d..ca6bc60377 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,23 +1,23 @@ { - "files": [], - "include": [], - "extends": "./tsconfig.shared.json", - "references": [ - { "path": "@packages/test-environment" }, - { "path": "@packages/test" }, - { "path": "@commitlint/ensure" }, - { "path": "@commitlint/execute-rule" }, - { "path": "@commitlint/format" }, - { "path": "@commitlint/is-ignored" }, - { "path": "@commitlint/load" }, - { "path": "@commitlint/message" }, - { "path": "@commitlint/parse" }, - { "path": "@commitlint/resolve-extends" }, - { "path": "@commitlint/to-lines" }, - { "path": "@commitlint/top-level" }, - { "path": "@commitlint/read" }, - { "path": "@commitlint/rules" }, - { "path": "@commitlint/lint" }, - { "path": "@commitlint/core" }, - ] + "files": [], + "include": [], + "extends": "./tsconfig.shared.json", + "references": [ + {"path": "@packages/test-environment"}, + {"path": "@packages/test"}, + {"path": "@commitlint/ensure"}, + {"path": "@commitlint/execute-rule"}, + {"path": "@commitlint/format"}, + {"path": "@commitlint/is-ignored"}, + {"path": "@commitlint/load"}, + {"path": "@commitlint/message"}, + {"path": "@commitlint/parse"}, + {"path": "@commitlint/resolve-extends"}, + {"path": "@commitlint/to-lines"}, + {"path": "@commitlint/top-level"}, + {"path": "@commitlint/read"}, + {"path": "@commitlint/rules"}, + {"path": "@commitlint/lint"}, + {"path": "@commitlint/core"} + ] } diff --git a/tsconfig.shared.json b/tsconfig.shared.json index 9567130005..ad1bb5892d 100644 --- a/tsconfig.shared.json +++ b/tsconfig.shared.json @@ -1,23 +1,23 @@ { - "compilerOptions": { - "target": "ES2017", - "lib": ["es2017"], - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "module": "commonjs", - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noUnusedLocals": true, - "noUnusedParameters": true, - "forceConsistentCasingInFileNames": true, - "keyofStringsOnly": true, - "noFallthroughCasesInSwitch": true, - "isolatedModules": true, - "skipLibCheck": true, - "downlevelIteration": true - } + "compilerOptions": { + "target": "ES2017", + "lib": ["es2017"], + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "module": "commonjs", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "forceConsistentCasingInFileNames": true, + "keyofStringsOnly": true, + "noFallthroughCasesInSwitch": true, + "isolatedModules": true, + "skipLibCheck": true, + "downlevelIteration": true + } }