commitlint-config-lotus

0.0.4 • Public • Published

commitlint-config-lotus

格式化你的提交,config-lotus

开始

1、安装依赖

yarn add -D @commitlint/cli husky
// commitlint加载配置导致需要这样处理
yarn add -D @commitlint/config-lotus@npm:commitlint-config-lotus

2、创建配置文件

项目根目录下新建commitlint.config.js

// commitlint.config.js

module.exports = {
  extends: ['@commitlint/config-lotus']
};

3、添加git hook

package.json 添加如下命令

"scripts": {
  "commitmsg": "commitlint -E GIT_PARAMS"
},

规则

可用规则请参考rules

type-enum

  • condition:type可以在value中找到
  • rule:always(总是)
  • value:
[
  'chore', // 构建过程或辅助工具变动
  'ci', // CI相关
  'docs', // 文档
  'feat', // 新功能
  'fix', // 修补bug
  'perf', // 性能优化
  'refactor', // 重构
  'revert', // 代码还原
  'style', // 格式(不影响代码运行的变动)
  'test' // 增加测试
]
  • example
// 失败
foo: some message
// 通过
fix: some message

type-case

  • condition: type的值为小写
  • rule::always(总是)
  • value:

lower-case

  • example
// 失败
FIX: some message
// 通过
fix: some message

type-empty

  • condition: type的值为空

  • rule::never(绝不)

  • example

// 失败
: some message
// 通过
fix: some message

scope-case

Package Sidebar

Install

npm i commitlint-config-lotus

Weekly Downloads

2

Version

0.0.4

License

MIT

Unpacked Size

2.62 kB

Total Files

3

Last publish

Collaborators

  • wangxingkang