diff --git a/@commitlint/cli/src/cli.test.js b/@commitlint/cli/src/cli.test.js index 3e8a17a91d..c65d18324f 100644 --- a/@commitlint/cli/src/cli.test.js +++ b/@commitlint/cli/src/cli.test.js @@ -88,7 +88,7 @@ test('should work with husky commitmsg hook and git commit', async () => { await execa('npm', ['install'], {cwd}); await execa('git', ['add', 'package.json'], {cwd}); - await execa('git', ['commit', '-m', '"chore: this should work"'], {cwd}); + await execa('git', ['commit', '-m', '"test: this should work"'], {cwd}); }); test('should work with husky commitmsg hook in sub packages', async () => { @@ -98,7 +98,7 @@ test('should work with husky commitmsg hook in sub packages', async () => { await execa('npm', ['install'], {cwd}); await execa('git', ['add', 'package.json'], {cwd}); - await execa('git', ['commit', '-m', '"chore: this should work"'], {cwd}); + await execa('git', ['commit', '-m', '"test: this should work"'], {cwd}); }); test('should pick up parser preset and fail accordingly', async t => { diff --git a/@commitlint/config-angular-type-enum/README.md b/@commitlint/config-angular-type-enum/README.md new file mode 100644 index 0000000000..1ee08c66de --- /dev/null +++ b/@commitlint/config-angular-type-enum/README.md @@ -0,0 +1,41 @@ +# @commitlint/config-angular-type-enum + +Shareable `commitlint` config enforcing the angular commit convention types. +Use with [@commitlint/cli](../cli) and [@commitlint/prompt-cli](../prompt-cli). + +See [@commitlint/config-angular](../config-angular) for full angular conventions. + +## Getting started + +```sh +npm install --save-dev @commitlint/config-angular-types @commitlint/cli +echo "module.exports = {extends: ['@commitlint/config-angular-type-enum']};" > commitlint.config.js +``` + +## Usage + +```sh +echo "foo: bar" | commitlint # fails +echo "build: bar" | commitlint # passes +``` + +## Examples + +```js +// commitlint.config.js +const types = require("@commitlint/config-angular-type-enum"); + +// Use as rule creating errors for non-allowed types +module.exports = { + rules: { + ...types.rules + } +}; + +// Warn for non-allowed types +module.exports = { + rules: { + 'type-enum': [1, 'always', types.values()] + } +}; +``` diff --git a/@commitlint/config-angular-type-enum/index.js b/@commitlint/config-angular-type-enum/index.js new file mode 100644 index 0000000000..4d9ff71ab8 --- /dev/null +++ b/@commitlint/config-angular-type-enum/index.js @@ -0,0 +1,18 @@ +const types = [ + 'build', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + 'test' +]; + +module.exports.rules = { + 'type-enum': [2, 'always', types] +}; + +module.exports.value = () => types; diff --git a/@commitlint/config-angular-type-enum/package.json b/@commitlint/config-angular-type-enum/package.json new file mode 100644 index 0000000000..a7e13c1155 --- /dev/null +++ b/@commitlint/config-angular-type-enum/package.json @@ -0,0 +1,31 @@ +{ + "name": "@commitlint/config-angular-type-enum", + "version": "4.3.0", + "description": "Shareable commitlint config enforcing the angular commit convention types", + "scripts": { + "clean": "exit 0", + "pretest": "dep-check", + "start": "exit 0", + "test": "exit 0" + }, + "xo": false, + "repository": { + "type": "git", + "url": "git+https://github.com/marionebl/commitlint.git" + }, + "keywords": [ + "conventional-changelog", + "commitlint", + "commitlint-config", + "angular" + ], + "author": "Mario Nebl ", + "license": "MIT", + "bugs": { + "url": "https://github.com/marionebl/commitlint/issues" + }, + "homepage": "https://github.com/marionebl/commitlint#readme", + "devDependencies": { + "@commitlint/utils": "^4.2.1" + } +} diff --git a/@commitlint/config-angular/README.md b/@commitlint/config-angular/README.md index 7733e62a46..318e51e145 100644 --- a/@commitlint/config-angular/README.md +++ b/@commitlint/config-angular/README.md @@ -27,7 +27,6 @@ Consult [docs/rules](http://marionebl.github.io/commitlint/#/reference-rules) fo ```js [ 'build', - 'chore', 'ci', 'docs', 'feat', @@ -40,6 +39,11 @@ Consult [docs/rules](http://marionebl.github.io/commitlint/#/reference-rules) fo ] ``` +```sh +echo "foo: some message" # fails +echo "fix: some message" # passes +``` + #### type-case * **description**: `type` is in case `value` * **rule**: `always` @@ -48,10 +52,20 @@ Consult [docs/rules](http://marionebl.github.io/commitlint/#/reference-rules) fo 'lowerCase' ``` +```sh +echo "FIX: some message" # fails +echo "fix: some message" # passes +``` + #### type-empty * **condition**: `type` is empty * **rule**: `never` +```sh +echo ": some message" # fails +echo "fix: some message" # passes +``` + #### scope-case * **condition**: `scope` is in case `value` * **rule**: `always` @@ -59,10 +73,33 @@ Consult [docs/rules](http://marionebl.github.io/commitlint/#/reference-rules) fo 'lowerCase' ``` +```sh +echo "fix(SCOPE): some message" # fails +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` + +```sh +echo "fix(SCOPE): Some message" # fails +echo "fix(SCOPE): Some Message" # fails +echo "fix(SCOPE): SomeMessage" # fails +echo "fix(SCOPE): SOMEMESSAGE" # fails +echo "fix(scope): some message" # passes +echo "fix(scope): some Message" # passes +``` + #### subject-empty * **condition**: `subject` is empty * **rule**: `never` +```sh +echo "fix:" # fails +echo "fix: some message" # passes +``` + #### subject-full-stop * **condition**: `subject` ends with `value` * **rule**: `never` @@ -71,6 +108,12 @@ Consult [docs/rules](http://marionebl.github.io/commitlint/#/reference-rules) fo '.' ``` +```sh +echo "fix: some message." # fails +echo "fix: some message" # passes +``` + + #### header-max-length * **condition**: `header` has `value` or less characters * **rule**: `always` @@ -79,17 +122,14 @@ Consult [docs/rules](http://marionebl.github.io/commitlint/#/reference-rules) fo 72 ``` +```sh +echo "fix: some message that is way too long and breaks the line max-length by several characters" # fails +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` - -#### lang -* **condition**: `subject` is of language `value` -* **rule**: `always` -* **value** -```js - eng -``` diff --git a/@commitlint/config-angular/index.js b/@commitlint/config-angular/index.js index ebe2071c28..00c76b49d3 100644 --- a/@commitlint/config-angular/index.js +++ b/@commitlint/config-angular/index.js @@ -1,29 +1,20 @@ +const typeEnum = require('@commitlint/config-angular-type-enum'); + module.exports = { rules: { 'body-leading-blank': [1, 'always'], 'footer-leading-blank': [1, 'always'], 'header-max-length': [2, 'always', 72], - 'scope-case': [2, 'always', 'lowerCase'], + 'scope-case': [2, 'always', 'lower-case'], + 'subject-case': [ + 2, + 'never', + ['sentence-case', 'start-case', 'pascal-case', 'upper-case'] + ], 'subject-empty': [2, 'never'], 'subject-full-stop': [2, 'never', '.'], - 'type-case': [2, 'always', 'lowerCase'], + 'type-case': [2, 'always', 'lower-case'], 'type-empty': [2, 'never'], - 'type-enum': [ - 2, - 'always', - [ - 'build', - 'chore', - 'ci', - 'docs', - 'feat', - 'fix', - 'perf', - 'refactor', - 'revert', - 'style', - 'test' - ] - ] + 'type-enum': typeEnum.rules['type-enum'] } }; diff --git a/@commitlint/config-angular/package.json b/@commitlint/config-angular/package.json index 23d8f918d1..9c283e3481 100644 --- a/@commitlint/config-angular/package.json +++ b/@commitlint/config-angular/package.json @@ -27,5 +27,8 @@ "homepage": "https://github.com/marionebl/commitlint#readme", "devDependencies": { "@commitlint/utils": "^4.2.1" + }, + "dependencies": { + "@commitlint/config-angular-type-enum": "^4.3.0" } } diff --git a/@commitlint/config-lerna-scopes/readme.md b/@commitlint/config-lerna-scopes/readme.md index e13bf68f33..166f330063 100644 --- a/@commitlint/config-lerna-scopes/readme.md +++ b/@commitlint/config-lerna-scopes/readme.md @@ -26,17 +26,17 @@ packages ├── app └── web -❯ echo "chore(api): fix something in api's build" | commitlint -⧗ input: chore(api): fix something in api's build +❯ echo "buid(api): change something in api's build" | commitlint +⧗ input: build(api): change something in api's build ✔ found 0 problems, 0 warnings -❯ echo "chore(foo): this won't pass" | commitlint -⧗ input: chore(foo): this won't pass +❯ echo "test(foo): this won't pass" | commitlint +⧗ input: test(foo): this won't pass ✖ scope must be one of [api, app, web] [scope-enum] ✖ found 1 problems, 0 warnings -❯ echo "chore: do some general maintenance" | commitlint -⧗ input: chore: do some general maintenance +❯ echo "ci: do some general maintenance" | commitlint +⧗ input: ci: do some general maintenance ✔ found 0 problems, 0 warnings ``` diff --git a/@commitlint/core/fixtures/overridden-type-enums/extended.js b/@commitlint/core/fixtures/overridden-type-enums/extended.js index a9faf85bb5..a63afd9070 100644 --- a/@commitlint/core/fixtures/overridden-type-enums/extended.js +++ b/@commitlint/core/fixtures/overridden-type-enums/extended.js @@ -5,7 +5,6 @@ module.exports = { 'always', [ 'build', - 'chore', 'ci', 'docs', 'feat', diff --git a/@commitlint/core/src/rules/body-case.test.js b/@commitlint/core/src/rules/body-case.test.js index d4b4f920f9..48058995cc 100644 --- a/@commitlint/core/src/rules/body-case.test.js +++ b/@commitlint/core/src/rules/body-case.test.js @@ -3,10 +3,10 @@ import parse from '../library/parse'; import bodyCase from './body-case'; const messages = { - empty: 'chore: subject', - lowercase: 'chore: subject\nbody', - mixedcase: 'chore: subject\nBody', - uppercase: 'chore: subject\nBODY' + empty: 'test: subject', + lowercase: 'test: subject\nbody', + mixedcase: 'test: subject\nBody', + uppercase: 'test: subject\nBODY' }; const parsed = { diff --git a/@commitlint/core/src/rules/body-empty.test.js b/@commitlint/core/src/rules/body-empty.test.js index e3b34ff1e9..a086e3fa80 100644 --- a/@commitlint/core/src/rules/body-empty.test.js +++ b/@commitlint/core/src/rules/body-empty.test.js @@ -3,8 +3,8 @@ import parse from '../library/parse'; import bodyEmpty from './body-empty'; const messages = { - empty: 'chore: subject', - filled: 'chore: subject\nbody' + empty: 'test: subject', + filled: 'test: subject\nbody' }; const parsed = { diff --git a/@commitlint/core/src/rules/body-leading-blank.test.js b/@commitlint/core/src/rules/body-leading-blank.test.js index 233452eb11..3350d30bc4 100644 --- a/@commitlint/core/src/rules/body-leading-blank.test.js +++ b/@commitlint/core/src/rules/body-leading-blank.test.js @@ -3,9 +3,9 @@ import parse from '../library/parse'; import bodyLeadingBlank from './body-leading-blank'; const messages = { - simple: 'chore: subject', - without: 'chore: subject\nbody', - with: 'chore: subject\n\nbody' + simple: 'test: subject', + without: 'test: subject\nbody', + with: 'test: subject\n\nbody' }; const parsed = { diff --git a/@commitlint/core/src/rules/body-max-length.test.js b/@commitlint/core/src/rules/body-max-length.test.js index 3b19e73fbb..0aba310973 100644 --- a/@commitlint/core/src/rules/body-max-length.test.js +++ b/@commitlint/core/src/rules/body-max-length.test.js @@ -8,9 +8,9 @@ const long = 'ab'; const value = short.length; const messages = { - empty: 'chore: subject', - short: `chore: subject\n${short}`, - long: `chore: subject\n${long}` + empty: 'test: subject', + short: `test: subject\n${short}`, + long: `test: subject\n${long}` }; const parsed = { diff --git a/@commitlint/core/src/rules/body-min-length.test.js b/@commitlint/core/src/rules/body-min-length.test.js index a85b996e68..430fa937ef 100644 --- a/@commitlint/core/src/rules/body-min-length.test.js +++ b/@commitlint/core/src/rules/body-min-length.test.js @@ -8,9 +8,9 @@ const long = 'ab'; const value = long.length; const messages = { - simple: 'chore: subject', - short: `chore: subject\n${short}`, - long: `chore: subject\n${long}` + simple: 'test: subject', + short: `test: subject\n${short}`, + long: `test: subject\n${long}` }; const parsed = { diff --git a/@commitlint/core/src/rules/body-tense.test.js b/@commitlint/core/src/rules/body-tense.test.js index 3e40a4d153..b8f393d73c 100644 --- a/@commitlint/core/src/rules/body-tense.test.js +++ b/@commitlint/core/src/rules/body-tense.test.js @@ -3,7 +3,7 @@ import parse from '../library/parse'; import bodyTense from './body-tense'; test('returns deprecation warning', async t => { - const actual = bodyTense(await parse('chore: \n'), 'always', [ + const actual = bodyTense(await parse('test: \n'), 'always', [ 'present-imperative' ]); t.deepEqual(actual, [ diff --git a/@commitlint/core/src/rules/footer-empty.test.js b/@commitlint/core/src/rules/footer-empty.test.js index f5e074c5a9..56f17135db 100644 --- a/@commitlint/core/src/rules/footer-empty.test.js +++ b/@commitlint/core/src/rules/footer-empty.test.js @@ -3,9 +3,9 @@ import parse from '../library/parse'; import footerEmpty from './footer-empty'; const messages = { - simple: 'chore: subject', - empty: 'chore: subject\nbody', - filled: 'chore: subject\nBREAKING CHANGE: something important' + simple: 'test: subject', + empty: 'test: subject\nbody', + filled: 'test: subject\nBREAKING CHANGE: something important' }; const parsed = { diff --git a/@commitlint/core/src/rules/footer-leading-blank.test.js b/@commitlint/core/src/rules/footer-leading-blank.test.js index 82a238dc18..02248dff13 100644 --- a/@commitlint/core/src/rules/footer-leading-blank.test.js +++ b/@commitlint/core/src/rules/footer-leading-blank.test.js @@ -3,15 +3,15 @@ import parse from '../library/parse'; import footerLeadingBlank from './footer-leading-blank'; const messages = { - simple: 'chore: subject', - body: 'chore: subject\nbody', - trailing: 'chore: subject\nbody\n\n', - without: 'chore: subject\nbody\nBREAKING CHANGE: something important', + simple: 'test: subject', + body: 'test: subject\nbody', + trailing: 'test: subject\nbody\n\n', + without: 'test: subject\nbody\nBREAKING CHANGE: something important', withoutBody: 'feat(new-parser): introduces a new parsing library\n\nBREAKING CHANGE: new library does not support foo-construct', - with: 'chore: subject\nbody\n\nBREAKING CHANGE: something important', + with: 'test: subject\nbody\n\nBREAKING CHANGE: something important', withMulitLine: - 'chore: subject\nmulti\nline\nbody\n\nBREAKING CHANGE: something important' + 'test: subject\nmulti\nline\nbody\n\nBREAKING CHANGE: something important' }; const parsed = { diff --git a/@commitlint/core/src/rules/footer-max-length.test.js b/@commitlint/core/src/rules/footer-max-length.test.js index 703820fab6..6ae1f4bda3 100644 --- a/@commitlint/core/src/rules/footer-max-length.test.js +++ b/@commitlint/core/src/rules/footer-max-length.test.js @@ -8,10 +8,10 @@ const long = 'BREAKING CHANGE: ab'; const value = short.length; const messages = { - simple: 'chore: subject', - empty: 'chore: subject\nbody', - short: `chore: subject\n${short}`, - long: `chore: subject\n${long}` + simple: 'test: subject', + empty: 'test: subject\nbody', + short: `test: subject\n${short}`, + long: `test: subject\n${long}` }; const parsed = { diff --git a/@commitlint/core/src/rules/footer-min-length.test.js b/@commitlint/core/src/rules/footer-min-length.test.js index 4092318949..a7ded16f84 100644 --- a/@commitlint/core/src/rules/footer-min-length.test.js +++ b/@commitlint/core/src/rules/footer-min-length.test.js @@ -8,10 +8,10 @@ const long = 'BREAKING CHANGE: ab'; const value = long.length; const messages = { - simple: 'chore: subject', - empty: 'chore: subject\nbody', - short: `chore: subject\n${short}`, - long: `chore: subject\n${long}` + simple: 'test: subject', + empty: 'test: subject\nbody', + short: `test: subject\n${short}`, + long: `test: subject\n${long}` }; const parsed = { diff --git a/@commitlint/core/src/rules/footer-tense.test.js b/@commitlint/core/src/rules/footer-tense.test.js index f65c58fb3b..1f9577b525 100644 --- a/@commitlint/core/src/rules/footer-tense.test.js +++ b/@commitlint/core/src/rules/footer-tense.test.js @@ -3,7 +3,7 @@ import parse from '../library/parse'; import footerTense from './footer-tense'; test('returns deprecation warning', async t => { - const actual = footerTense(await parse('chore: subject\nbody'), 'always', [ + const actual = footerTense(await parse('test: subject\nbody'), 'always', [ 'present-imperative' ]); t.deepEqual(actual, [ diff --git a/@commitlint/core/src/rules/header-max-length.test.js b/@commitlint/core/src/rules/header-max-length.test.js index 08e3f4a2e8..bba32930c5 100644 --- a/@commitlint/core/src/rules/header-max-length.test.js +++ b/@commitlint/core/src/rules/header-max-length.test.js @@ -2,8 +2,8 @@ import test from 'ava'; import parse from '../library/parse'; import check from './header-max-length'; -const short = 'chore: a'; -const long = 'chore: ab'; +const short = 'test: a'; +const long = 'test: ab'; const value = short.length; diff --git a/@commitlint/core/src/rules/index.js b/@commitlint/core/src/rules/index.js index 13eaa9a995..c6c1cb24ab 100644 --- a/@commitlint/core/src/rules/index.js +++ b/@commitlint/core/src/rules/index.js @@ -23,7 +23,6 @@ export default { 'subject-case': require('./subject-case'), 'subject-empty': require('./subject-empty'), 'subject-full-stop': require('./subject-full-stop'), - 'subject-leading-capital': require('./subject-leading-capital'), 'subject-max-length': require('./subject-max-length'), 'subject-min-length': require('./subject-min-length'), 'subject-tense': require('./subject-tense'), diff --git a/@commitlint/core/src/rules/scope-case.test.js b/@commitlint/core/src/rules/scope-case.test.js index c87f7b8a6c..4221021204 100644 --- a/@commitlint/core/src/rules/scope-case.test.js +++ b/@commitlint/core/src/rules/scope-case.test.js @@ -3,15 +3,15 @@ import parse from '../library/parse'; import scopeCase from './scope-case'; const messages = { - empty: 'chore: subject', - lowercase: 'chore(scope): subject', - mixedcase: 'chore(sCoPe): subject', - uppercase: 'chore(SCOPE): subject', - camelcase: 'chore(myScope): subject', - kebabcase: 'chore(my-scope): subject', - pascalcase: 'chore(MyScope): subject', - snakecase: 'chore(my_scope): subject', - startcase: 'chore(My Scope): subject' + empty: 'test: subject', + lowercase: 'test(scope): subject', + mixedcase: 'test(sCoPe): subject', + uppercase: 'test(SCOPE): subject', + camelcase: 'test(myScope): subject', + kebabcase: 'test(my-scope): subject', + pascalcase: 'test(MyScope): subject', + snakecase: 'test(my_scope): subject', + startcase: 'test(My Scope): subject' }; const parsed = { diff --git a/@commitlint/core/src/rules/scope-max-length.test.js b/@commitlint/core/src/rules/scope-max-length.test.js index b2227c46db..581e8a5479 100644 --- a/@commitlint/core/src/rules/scope-max-length.test.js +++ b/@commitlint/core/src/rules/scope-max-length.test.js @@ -8,9 +8,9 @@ const long = 'ab'; const value = short.length; const messages = { - empty: 'chore: \n', - short: `chore(${short}): \n`, - long: `chore(${long}): \n` + empty: 'test: \n', + short: `test(${short}): \n`, + long: `test(${long}): \n` }; const parsed = { diff --git a/@commitlint/core/src/rules/scope-min-length.test.js b/@commitlint/core/src/rules/scope-min-length.test.js index f0090cf062..6fa25f0059 100644 --- a/@commitlint/core/src/rules/scope-min-length.test.js +++ b/@commitlint/core/src/rules/scope-min-length.test.js @@ -8,9 +8,9 @@ const long = 'ab'; const value = long.length; const messages = { - empty: 'chore:\n', - short: `chore(${short}): \n`, - long: `chore(${long}): \n` + empty: 'test:\n', + short: `test(${short}): \n`, + long: `test(${long}): \n` }; const parsed = { diff --git a/@commitlint/core/src/rules/signed-off-by.test.js b/@commitlint/core/src/rules/signed-off-by.test.js index 98a5e780dd..ed7d8377d9 100644 --- a/@commitlint/core/src/rules/signed-off-by.test.js +++ b/@commitlint/core/src/rules/signed-off-by.test.js @@ -3,11 +3,11 @@ import parse from '../library/parse'; import check from './signed-off-by'; const messages = { - empty: 'chore:\n', - with: `chore: subject\nbody\nfooter\nSigned-off-by:\n\n`, - without: `chore: subject\nbody\nfooter\n\n`, - inSubject: `chore: subject Signed-off-by:\nbody\nfooter\n\n`, - inBody: `chore: subject\nbody Signed-off-by:\nfooter\n\n` + empty: 'test:\n', + with: `test: subject\nbody\nfooter\nSigned-off-by:\n\n`, + without: `test: subject\nbody\nfooter\n\n`, + inSubject: `test: subject Signed-off-by:\nbody\nfooter\n\n`, + inBody: `test: subject\nbody Signed-off-by:\nfooter\n\n` }; const parsed = { diff --git a/@commitlint/core/src/rules/subject-case.js b/@commitlint/core/src/rules/subject-case.js index 84177a4c7a..40cc22e560 100644 --- a/@commitlint/core/src/rules/subject-case.js +++ b/@commitlint/core/src/rules/subject-case.js @@ -20,13 +20,15 @@ export default (parsed, when, value) => { return check; }); - const result = checks.every(check => { + const result = checks.some(check => { const r = ensureCase(subject, check.case); return negated(check.when) ? !r : r; }); + const list = checks.map(c => c.case).join(', '); + return [ negated(when) ? !result : result, - message([`subject must`, negated ? `not` : null, `be ${value}`]) + message([`subject must`, negated ? `not` : null, `be ${list}`]) ]; }; diff --git a/@commitlint/core/src/rules/subject-case.test.js b/@commitlint/core/src/rules/subject-case.test.js index 8687e1eb3a..2204afdb15 100644 --- a/@commitlint/core/src/rules/subject-case.test.js +++ b/@commitlint/core/src/rules/subject-case.test.js @@ -3,15 +3,15 @@ import parse from '../library/parse'; import subjectCase from './subject-case'; const messages = { - empty: 'chore:\n', - lowercase: 'chore: subject', - mixedcase: 'chore: sUbJeCt', - uppercase: 'chore: SUBJECT', - camelcase: 'chore: subJect', - kebabcase: 'chore: sub-ject', - pascalcase: 'chore: SubJect', - snakecase: 'chore: sub_ject', - startcase: 'chore: Sub Ject' + empty: 'test:\n', + lowercase: 'test: subject', + mixedcase: 'test: sUbJeCt', + uppercase: 'test: SUBJECT', + camelcase: 'test: subJect', + kebabcase: 'test: sub-ject', + pascalcase: 'test: SubJect', + snakecase: 'test: sub_ject', + startcase: 'test: Sub Ject' }; const parsed = { diff --git a/@commitlint/core/src/rules/subject-empty.test.js b/@commitlint/core/src/rules/subject-empty.test.js index e0482d855a..06d4a535a8 100644 --- a/@commitlint/core/src/rules/subject-empty.test.js +++ b/@commitlint/core/src/rules/subject-empty.test.js @@ -3,8 +3,8 @@ import parse from '../library/parse'; import subjectEmpty from './subject-empty'; const messages = { - empty: 'chore: \nbody', - filled: 'chore: subject\nbody' + empty: 'test: \nbody', + filled: 'test: subject\nbody' }; const parsed = { diff --git a/@commitlint/core/src/rules/subject-full-stop.test.js b/@commitlint/core/src/rules/subject-full-stop.test.js index 7a3d4413cf..7e961723e2 100644 --- a/@commitlint/core/src/rules/subject-full-stop.test.js +++ b/@commitlint/core/src/rules/subject-full-stop.test.js @@ -3,9 +3,9 @@ import parse from '../library/parse'; import check from './subject-full-stop'; const messages = { - empty: 'chore:\n', - with: `chore: subject.\n`, - without: `chore: subject\n` + empty: 'test:\n', + with: `test: subject.\n`, + without: `test: subject\n` }; const parsed = { diff --git a/@commitlint/core/src/rules/subject-leading-capital.js b/@commitlint/core/src/rules/subject-leading-capital.js deleted file mode 100644 index 09c0de4ddc..0000000000 --- a/@commitlint/core/src/rules/subject-leading-capital.js +++ /dev/null @@ -1,20 +0,0 @@ -// TODO -// * rename this to "subject-first-character" -import message from '../library/message'; -import ensureCase from '../library/ensure-case'; - -export default (parsed, when = 'always', value = 'uppercase') => { - const input = parsed.subject; - - if (!input) { - return [true]; - } - - const negated = when === 'never'; - const result = ensureCase(input[0], value); - - return [ - negated ? !result : result, - message([`message must`, negated ? `not` : null, `be ${value}`]) - ]; -}; diff --git a/@commitlint/core/src/rules/subject-leading-capital.test.js b/@commitlint/core/src/rules/subject-leading-capital.test.js deleted file mode 100644 index eb920ce345..0000000000 --- a/@commitlint/core/src/rules/subject-leading-capital.test.js +++ /dev/null @@ -1,69 +0,0 @@ -import test from 'ava'; -import parse from '../library/parse'; -import check from './subject-leading-capital'; - -const messages = { - empty: 'chore:\n', - with: `chore: Subject\n`, - without: `chore: subject\n` -}; - -const parsed = { - empty: parse(messages.empty), - with: parse(messages.with), - without: parse(messages.without) -}; - -test('empty should succeed', async t => { - const [actual] = check(await parsed.empty); - const expected = true; - t.is(actual, expected); -}); - -test('empty against "always" should succeed', async t => { - const [actual] = check(await parsed.empty, 'always', 'uppercase'); - const expected = true; - t.is(actual, expected); -}); - -test('empty against "never" should succeed', async t => { - const [actual] = check(await parsed.empty, 'never', 'uppercase'); - const expected = true; - t.is(actual, expected); -}); - -test('with should succeed', async t => { - const [actual] = check(await parsed.with); - const expected = true; - t.is(actual, expected); -}); - -test('with against "always" should succeed', async t => { - const [actual] = check(await parsed.with, 'always', 'uppercase'); - const expected = true; - t.is(actual, expected); -}); - -test('with against "never" should fail', async t => { - const [actual] = check(await parsed.with, 'never', 'uppercase'); - const expected = false; - t.is(actual, expected); -}); - -test('without should fail', async t => { - const [actual] = check(await parsed.without, 'always', 'uppercase'); - const expected = false; - t.is(actual, expected); -}); - -test('without against "always" should fail', async t => { - const [actual] = check(await parsed.without, 'always', 'uppercase'); - const expected = false; - t.is(actual, expected); -}); - -test('without against "never" should succeed', async t => { - const [actual] = check(await parsed.without, 'never', 'uppercase'); - const expected = true; - t.is(actual, expected); -}); diff --git a/@commitlint/core/src/rules/subject-max-length.test.js b/@commitlint/core/src/rules/subject-max-length.test.js index 432ce73de0..5ade7975b8 100644 --- a/@commitlint/core/src/rules/subject-max-length.test.js +++ b/@commitlint/core/src/rules/subject-max-length.test.js @@ -8,9 +8,9 @@ const long = 'ab'; const value = short.length; const messages = { - empty: 'chore:\n', - short: `chore: ${short}\n`, - long: `chore: ${long}\n` + empty: 'test:\n', + short: `test: ${short}\n`, + long: `test: ${long}\n` }; const parsed = { diff --git a/@commitlint/core/src/rules/subject-min-length.test.js b/@commitlint/core/src/rules/subject-min-length.test.js index b1df88d5ce..9aa4774208 100644 --- a/@commitlint/core/src/rules/subject-min-length.test.js +++ b/@commitlint/core/src/rules/subject-min-length.test.js @@ -8,9 +8,9 @@ const long = 'ab'; const value = long.length; const messages = { - empty: 'chore:\n', - short: `chore: ${short}\n`, - long: `chore: ${long}\n` + empty: 'test:\n', + short: `test: ${short}\n`, + long: `test: ${long}\n` }; const parsed = { diff --git a/@commitlint/core/src/rules/subject-tense.test.js b/@commitlint/core/src/rules/subject-tense.test.js index 2c060d3592..5ffe393cac 100644 --- a/@commitlint/core/src/rules/subject-tense.test.js +++ b/@commitlint/core/src/rules/subject-tense.test.js @@ -3,7 +3,7 @@ import parse from '../library/parse'; import subjectTense from './subject-tense'; test('returns deprecation warning', async t => { - const actual = subjectTense(await parse('chore: '), 'always', [ + const actual = subjectTense(await parse('test: '), 'always', [ 'present-imperative' ]); t.deepEqual(actual, [ diff --git a/@commitlint/prompt/src/settings.js b/@commitlint/prompt/src/settings.js index 49a6188ebf..d2392c5fa6 100644 --- a/@commitlint/prompt/src/settings.js +++ b/@commitlint/prompt/src/settings.js @@ -23,9 +23,6 @@ export default { }, test: { description: 'Adds or modifies tests.' - }, - chore: { - description: 'Change build process, tooling or dependencies.' } } }, diff --git a/docs/reference-rules.md b/docs/reference-rules.md index cc1c5824e6..53c5c430d3 100644 --- a/docs/reference-rules.md +++ b/docs/reference-rules.md @@ -204,7 +204,6 @@ Rule configurations are either of type `array` residing on a key with the rule's 'style', 'refactor', 'test', - 'chore', 'revert' ] ``` @@ -214,7 +213,7 @@ Rule configurations are either of type `array` residing on a key with the rule's * **rule**: `always` * **value** ```js - 'lowerCase' + 'lower-case' ``` * **possible values** ```js