UNPKG

commitlint-config-git-commit-emoji

Version:

Shareable commitlint config for the VS Code extension git-commit-plugin with emoji enabled

216 lines (155 loc) โ€ข 4.77 kB
# commitlint-config-git-commit-emoji [![npm latest][version-img]][pkg-url] [![download][download-img]][pkg-url] [![MIT][license-img]](LICENSE) Shareable `commitlint` config for the VS Code extension [git-commit-plugin](https://github.com/RedJue/git-commit-plugin) with emoji enabled. Use with [commitlint](https://github.com/conventional-changelog/commitlint). ## Getting started ```sh npm install --save-dev @commitlint/cli commitlint-config-git-commit-emoji echo "module.exports = {extends: ['git-commit-emoji']};" > .commitlintrc.js ``` ## Format ```text <emoji> <type>(<scope>): <subject> <BLANK LINE> <body> <BLANK LINE> <footer> ``` ### Example ```text โœจ feat(blog): add comment section ``` ## Rules ### Problems The following rules are considered problems for `commitlint-config-git-commit-emoji` 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** ```text [ '๐ŸŽ‰ init', 'โœจ feat', '๐Ÿž fix', '๐Ÿ“ƒ docs', '๐ŸŒˆ style', '๐Ÿฆ„ refactor', '๐ŸŽˆ perf', '๐Ÿงช test', '๐Ÿ”ง build', '๐ŸŽ ci', '๐Ÿณ chore', 'โ†ฉ revert', ] ``` ```sh echo "foo: some message" # fails echo "๐Ÿž fix: some message" # passes ``` #### type-case - **description**: `type` is in case `value` - **rule**: `always` - **value** ```text '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` ```text '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` - **value** ```text '.' ``` ```sh echo "๐Ÿž fix: some message." # fails echo "๐Ÿž fix: some message" # passes ``` #### subject-exclamation-mark - **condition**: `subject` must not have a `!` before the `:` marker - **rule**: `never` The [angular commit convention](hhttps://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit) dose not use a `!` to define a breaking change in the commit subject. If you want to use this feature please consider using the [conventional commit config](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#commitlintconfig-conventional). #### header-max-length - **condition**: `header` has `value` or less characters - **rule**: `always` - **value** ```text 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 ``` #### body-leading-blank - **condition**: Body should have a leading blank line - **rule**: `always` ```sh echo "๐Ÿž fix: some message body" # fails echo "๐Ÿž fix: some message body" # passes ``` #### footer-leading-blank - **condition**: Footer should have a leading blank line - **rule**: `always` ```sh echo "๐Ÿž fix: some message BREAKING CHANGE: It will be significant" # fails echo "๐Ÿž fix: some message BREAKING CHANGE: It will be significant" # passes ``` ## Thanks - Header regex pattern modified from [@gitmoji/parser-opts](https://github.com/arvinxx/gitmoji-commit-workflow/blob/master/packages/parser-opts/README.md) - Most of the rules come from [@commitlint/config-angular](https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-angular/README.md) ## License [MIT](LICENSE) ยฉ Nor Cod <!-- badge url --> [pkg-url]: https://www.npmjs.com/package/commitlint-config-git-commit-emoji [version-img]: https://img.shields.io/npm/v/commitlint-config-git-commit-emoji?color=deepgreen&style=flat-square [download-img]: https://img.shields.io/npm/dm/commitlint-config-git-commit-emoji?style=flat-square [license-img]: https://img.shields.io/badge/license-MIT-blue?style=flat-square