gw-commit-lint

0.0.4 • Public • Published

gw-commit-lint

简单可配置的commit约束工具。

Usage:

安装npm install --save-dev gw-commit-lint。 在package.json中配置,建议结合husky使用。

"husky": {
    "hooks": {
      "commit-msg": "gw-commit-lint HUSKY_GIT_PARAMS"
    }
  },

gw-commit-lint默认集成了一套规则:

type(scope?): subject #scope is optional

规则参考自:https://www.conventionalcommits.org/zh/v1.0.0-beta.2/

Config:

如果你不满足于默认配置,也可以通过在package.json中添加配置项来扩展规则。

exclude[Array]:如果你希望gw-commit-lint忽略某些格式的校验,可以配置在exclude下面,默认跳过Merge Request的commit。

types[Array]:如果你想增加自定义commit types,可以配置在types下面,默认的types:feat|fix|polish|docs|style|refactor|perf|test|workflow|ci|chore|types|build|misc

formats[Array]:如果你不想用默认的规则,想自定义自己的规则,可以在此配置。

Example:

 "gw-commit-lint" : {
    "exclude": [
      "/foo/g",
      "bar"
    ],
    "types": [
      "misc",
      "lalala"
    ],
    "formats": [
      "/a complex regExp formats here/img",
      "string is also ok"
    ]
  },

TODO:

test should be add

Package Sidebar

Install

npm i gw-commit-lint

Weekly Downloads

1

Version

0.0.4

License

ISC

Unpacked Size

5.86 kB

Total Files

5

Last publish

Collaborators

  • fokess