Doesn't allow developers push changes if commit message doesn't correspond rules. This is an alternative for commitint. The main difference from current library is that it fully bases on conventionalcommits.org.
This library based on this rule by default:
<issue prefix> <module 1>[/<sub-module>][, ..., <module N>[/<sub-module>]]: <content in past tense 1>[,
..., <content in paste tense M>][; ...; <moduleK>[/<sub-module>]: <content in past tense>]
But you can also set your own commit messages style.
Example of commit with single changes:
TAX-20 header: added navigation bar
Example of commit with multiple changes:
TAX-20 product/feedbacks: added the ability to set stars; user: supported history
husky
:1.3.x
-
Install plugin here:
yarn add @eigenspace/commit-linter --dev
or
npm install @eigenspace/commit-linter --dev
-
Just add this for your husky hooks in
package.json
:... "husky": { "hooks": { ... "commit-msg": "commit-linter --message=COMMIT_MESSAGE" ... } } ...
-
Add
.commit-linter.config.json
in the root of your project and set your issue prefixes:{ "extends": "./node_modules/@eigenspace/commit-linter/.commit-linter.base.config.json", "issuePrefixes": [ "TAX-[\d]+" ] }
All configuration are in .commit-linter.config.json
file:
You can set file you want to extend from:
"extends": ".commit-linter.base.config.json",
For single change:
<task prefix> <content>
For multiple changes:
<task prefix> <content 1>; <content 2>; <content N>
For instance, you can override by your own regexp for commit body:
"body": "^([a-z\\/,\\- ]+?): (([a-z]+?ed|set|reset|draft) [a-z A-Z 0-9,]+)$",
It's like what your commit can start with. For instance, #28
, feature/cart
, DXAPP-124
and
so on.
Example of config:
"issuePrefixes": ["microfix", "TAX-[0-9]+"],
You can set regex to ignore linting messages. For instance, it could be:
Merge dev in master
or auto/ci: set version to 4.1.1
.
Default config is:
"ignore": ["^Merge .*", "^auto/.*"]
This is a reference to page with rule description. By default there is a:
"linkToRule": "https://github.com/eigen-space/codestyle/tree/dev/doc/common#512-сообщение-к-изменению"
@eigenspace/argument-parser
- parsing arguments from node process.
@types/*
- contains type definitions for specific library.@eigenspace/eslint-config-codestyle
- project with eslint config files.@eigenspace/helper-scripts
- common scripts for dev. environment.eslint
- it checks code for readability, maintainability, and functionality errors.@eigenspace/codestyle
- includes lint rules, config for typescript.husky
- used for configure git hooks.ts-jest
- it lets you use Jest to test projects written in TypeScript.jest
- testing.lint-staged
- used for configure linters against staged git files.typescript
- is a superset of JavaScript that have static type-checking and ECMAScript features.