From c07d691bcc5805369233747b1af6d1eedb7decc8 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Sun, 25 Nov 2018 14:58:28 +0100 Subject: [PATCH 1/5] docs: add what-is section #471 --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/README.md b/README.md index da21c41e75..73448d8594 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ ## Contents +* [What is commitlint](#what-is-commitlint) + * [Benefits using commitlint](#benefits-using-commitlint) * [Getting started](#getting-started) * [CLI](#cli) * [Config](#config) @@ -35,6 +37,43 @@ * * * +## What is commitlint +Commitlint is a linter which is linting your commit-messages according to 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/marionebl/commitlint/tree/master/%40commitlint/config-conventional#type-enum) can be: +- build +- ci +- chore +- docs +- feat +- fix +- perf +- refactor +- revert +- style +- test + +These can be modified by your own configuration. + +### 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 From fdd47b190a126169624854ae7411d8e9d7fa32e7 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Sun, 25 Nov 2018 15:13:02 +0100 Subject: [PATCH 2/5] feat(format): add help link to summary #471 --- @commitlint/format/src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/@commitlint/format/src/index.js b/@commitlint/format/src/index.js index 2ef4065932..d68eb83072 100644 --- a/@commitlint/format/src/index.js +++ b/@commitlint/format/src/index.js @@ -62,7 +62,8 @@ function formatResult(result = {}, options = {}) { const decoration = enabled ? chalk[color](sign) : sign; const summary = `${decoration} found ${errors.length} problems, ${ warnings.length - } warnings`; + } warnings\n Need help? -> https://github.com/marionebl/commitlint#what-is-commitlint + `; return [...problems, enabled ? chalk.bold(summary) : summary]; } From 7a047091d7afee50e18cce1817cfd66eb3b104f1 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Sun, 25 Nov 2018 15:33:44 +0100 Subject: [PATCH 3/5] feat(format): update tests #471 --- @commitlint/format/src/index.js | 3 +-- @commitlint/format/src/index.test.js | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/@commitlint/format/src/index.js b/@commitlint/format/src/index.js index d68eb83072..81ff37f00e 100644 --- a/@commitlint/format/src/index.js +++ b/@commitlint/format/src/index.js @@ -62,8 +62,7 @@ function formatResult(result = {}, options = {}) { const decoration = enabled ? chalk[color](sign) : sign; const summary = `${decoration} found ${errors.length} problems, ${ warnings.length - } warnings\n Need help? -> https://github.com/marionebl/commitlint#what-is-commitlint - `; + } warnings \n (Need help? -> https://github.com/marionebl/commitlint#what-is-commitlint)`; return [...problems, enabled ? chalk.bold(summary) : summary]; } diff --git a/@commitlint/format/src/index.test.js b/@commitlint/format/src/index.test.js index b3ff2a28fe..2abae7bb66 100644 --- a/@commitlint/format/src/index.test.js +++ b/@commitlint/format/src/index.test.js @@ -3,7 +3,11 @@ import chalk from 'chalk'; import includes from 'lodash.includes'; import format from '.'; -const ok = chalk.bold(`${chalk.green('✔')} found 0 problems, 0 warnings`); +const ok = chalk.bold( + `${chalk.green( + '✔' + )} found 0 problems, 0 warnings \n (Need help? -> https://github.com/marionebl/commitlint#what-is-commitlint)` +); test('does nothing without arguments', t => { const actual = format(); From 23582f599586af31ccc91a2469b1957352a094eb Mon Sep 17 00:00:00 2001 From: escapedcat Date: Sun, 25 Nov 2018 19:26:50 +0100 Subject: [PATCH 4/5] docs: add link to config info #471 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 73448d8594..f034ba09e5 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Common types according to [commitlint-config-conventional (based on the the Angu - style - test -These can be modified by your own configuration. +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) From b5695684f6e12e8363bcb4097b927e6237d2c9bd Mon Sep 17 00:00:00 2001 From: escapedcat Date: Sun, 25 Nov 2018 19:28:10 +0100 Subject: [PATCH 5/5] docs: copytext #471 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f034ba09e5..4a866e025b 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ * * * ## What is commitlint -Commitlint is a linter which is linting your commit-messages according to the [conventional commit format](https://conventionalcommits.org). +commitlint checks if your commit messages meet the [conventional commit format](https://conventionalcommits.org). In general the pattern mostly looks like this: ```sh