Giter Site home page Giter Site logo

whizark / commitlint-config-cz Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 9.0 544 KB

:gear: commitlint sharable configuration, automatically converts/merges your cz-customizable (commitizen) config.

License: MIT License

JavaScript 100.00%
commitizen conventional-changelog conventional-changelog-lint cz-cli cz-customizable commitlint commitlint-config conventional-commits

commitlint-config-cz's Introduction

Whizark's github statsstats Top Languages

commitlint-config-cz's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar renovate-bot avatar renovate[bot] avatar whizark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

commitlint-config-cz's Issues

commlint Always wrong?

Hi,@whizark, I appear some isses again.

What happened

I npm install those:

   "@commitlint/cli": "^8.2.0",
    "commitizen": "^4.0.3",
    "commitlint-config-cz": "^0.12.1",
    "cz-customizable": "^6.2.0",
    "husky": "^3.1.0",

this is my .cz.config.js:

module.exports = {
  types: [
    { value: 'feat✨', name: '特性: 一个新的特性' },
    { value: 'fix🐞', name: '修复: 修复一个Bug' },
    { value: 'docs📚', name: '文档: 变更的只有文档' },
    { value: 'style💅', name: '格式: 空格, 分号等格式修复' },
    { value: 'refactor🛠', name: '重构: 代码重构,注意和特性、修复区分开' },
    { value: 'perf🐎', name: '性能: 提升性能' },
    { value: 'test🏁', name: '测试: 添加一个测试' },
    { value: 'revert⏪', name: '回滚: 代码回退' },
    { value: 'chore🗯', name: '工具:开发工具变动(构建、脚手架工具等)' }
  ],
  messages: {
    type: '选择一种你的提交类型:',
    customScope: '请输入修改范围(可选):',
    subject: '短说明:',
    body: '长说明,使用"|"换行(可选):',
    footer: '关联关闭的issue,例如:#31, #34(可选):',
    confirmCommit: '确定提交说明?'
  },
  allowCustomScopes: true,
  allowBreakingChanges: ['特性', '修复'],
  subjectLimit: 100
}

this is my commitlint.config.js:

module.exports = {
    extends: [
        'cz'
    ],
    rules: {
        'type-empty': [2, 'never'],
        'subject-empty': [2, 'never']
    }
}

and this is my project.json settings:

...
"config": {
    "commitizen": {
      "path": "node_modules/cz-customizable"
    }
  },
  "cz-customizable": {
    "config": ".cz-config.js"
  },
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  }

after I finish those step, I use npm run commit to generate commit message, but the commlint check always fails !😫 Just like this:

屏幕快照 2019-12-22 16 32 55

In fact, I have selected the type and input the subject. you can see:

? 选择一种你的提交类型: 修复: 修复一个Bug   // this is my type
? 短说明: 代码提交bug   // this is my subject

But the commlint check always fails ! I don't know why, hope got your help !!

My Project

https://github.com/xieyezi/Learn-notes

Didn't work?

version:

"commitlint-config-cz": "^0.12.1"

bug:

I use npm install commitlint-config-cz --save-dev install commitlint-config-cz,and I use it with commitizen and cz-customizable, but it not work.

this is my project.json:

 "config": {
    "commitizen": {
      "path": "node_modules/cz-customizable"
    }
  },
  "cz-customizable": {
    "config": "cz-config.js"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{ts,tsx}": [
      "npm run lint:ts",
      "npm run format",
      "git add"
    ]
  }
}

this is my commitlint.config.js:

module.exports = {
    extends: [
        'cz'
    ]
};

this is my .cz-config.js:

module.exports = {
  types: [
    { value: 'feat✨', name: '特性: 一个新的特性' },
    { value: 'fix🐞', name: '修复: 修复一个Bug' },
    { value: 'docs📚', name: '文档: 变更的只有文档' },
    { value: 'style💅', name: '格式: 空格, 分号等格式修复' },
    { value: 'refactor🛠', name: '重构: 代码重构,注意和特性、修复区分开' },
    { value: 'perf🐎', name: '性能: 提升性能' },
    { value: 'test🏁', name: '测试: 添加一个测试' },
    { value: 'revert⏪', name: '回滚: 代码回退' },
    { value: 'chore🗯', name: '工具:开发工具变动(构建、脚手架工具等)' }
  ],
  messages: {
    type: '选择一种你的提交类型:',
    customScope: '请输入修改范围(可选):',
    subject: '短说明:',
    body: '长说明,使用"|"换行(可选):',
    footer: '关联关闭的issue,例如:#31, #34(可选):',
    confirmCommit: '确定提交说明?'
  },
  allowCustomScopes: true,
  allowBreakingChanges: ['特性', '修复'],
  subjectLimit: 100
}

What's Happening

after i write those,I use git commit -m "xxxx" directly to commit, it's still pass the check,i don't konw why,hope got you resolve! thank you!

repository

this is my repository

How to generate custom commit CHANGELOG

I used the self -defined commit type

// .cz-config.js
'use strict';

module.exports = {
  types: [
    {
      value: ':rocket: release',
      name: '🚀  release:  发布版本/发布标签',
    },
    {
      value: ':construction: WIP',
      name: '💪  WIP:      正在进行的工作',
    },
    {
      value: ':sparkles: feat',
      name: '✨  feat:     新的特性',
    },
    {
      value: ':bug: fix',
      name: '🐛  fix:      修复Bug',
    },
    {
      value: ':wrench: CI',
      name: '🔧  CI:       目录结构变更(CI, Building, Tool...)',
    },

    {
      value: ':pencil: docs',
      name: '📝  docs:     仅文档更改',
    },
    {
      value: ':twisted_rightwards_arrows: merge',
      name: '🔀  merge:    合并分支',
    },
    {
      value: ':rewind: revert',
      name: '⏪  revert:   版本回滚',
    },
    {
      value: ':white_check_mark: test',
      name: '✅  test:     添加缺失的测试或更正现有测试',
    },
    {
      value: ':chart_with_upwards_trend: perf',
      name: '📈  perf:     提高性能的代码更改',
    },
    {
      value: ':thought_balloon: chore',
      name: '🗯   chore:    不修改src或测试文件的更改。例如更新构建任务、包管理器',
    },
    {
      value: ':lipstick: ui',
      name: '💄  UI:       更新UI和样式文件。',
    },
    {
      value: ':art: style',
      name: '🎨  style:    不影响代码含义的更改(空白、格式、缺少分号等)',
    },
    {
      value: ':package: dep_up',
      name: '📦  dep_up:   更新已编译的文件或包。',
    },

    {
      value: ':hammer: refactor',
      name: '🔨  refactor: 既不修复错误也不添加功能的代码更改',
    },
    {
      value: ':truck: mv',
      name: '🚚  mv:       移动或重命名文件。',
    },
  ],

  scopes: [],
  messages: {
    type: '选择一种你的提交类型:',
    scope: '选择一个scope (可选):',
    // used if allowCustomScopes is true
    customScope: '表示该变更的范围:',
    subject: '短说明:\n',
    body: '长说明,使用"|"换行(可选):\n',
    breaking: '非兼容性说明 (可选):\n',
    footer: '关联关闭的issue,例如:#31, #34(可选):\n',
    confirmCommit: '确定提交说明? yes/no',
  },
  allowCustomScopes: true,
  allowBreakingChanges: ['feat', 'fix'],
};

There is no problem in submitting all of this

But when I generated CHANGELOG, the format was incorrect

"version": "conventional-changelog -p cz-customizable -i CHANGELOG.md -s -r 0 -n && git add CHANGELOG.md "

I specify the parser as cz-customizable,

Otherwise, these custom commit type cannot be written to CHANGELOG normally

image

something wrong with lerna

when I lerna publish or lerna version, it will show lerna ERR! Error: Command failed with exit code 1: git commit -F /.../lerna-commit.txt, even if I config the commitlint.config.js like this extends: ['lerna','cz'], It will show Error: Cannot find module "conventional-changelog-lint-config-lerna" from , So, how can I resolve this problem, please give your advice, thanks very much

Accept cz config as an object

I'm not sure what kind of API works here, but let me describe my problem.

I built https://github.com/paulirish/commitlintbot which lints the title of Pull Requests with commitlint. As my project has custom types, I also use cz and thus I really appreciate you making this package which wires it all up very nicely. (thanks!)

But here's my challenge: The bot pulls the commitlint.config and cz-config over the github API, and then uses them to lint the title. All good so far, but I run this bot on now.sh which doesn't allow you to write to disk. And since commitlint-config-cz will only read the .cz-config.js from disk, I can't supply the configuration correctly.

Unfortunately I don't have a concrete proposal for how this could be done, but I'd be happy with something a little hacky if that's fine with you. :)

Cheers

Type presence is not checked

When using cz as config for commitlint, the presence of the type is not checked, only its value if it is present. or instance:

  • my bad commit : commitlint does not throw an error
  • foo: my bad commit : commitlint throws an error about the type value

But, if I configure commitlint to extend @commitlint/config-conventional, both cases throw errors.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • app-root-path ~3.0.0
  • lodash.clonedeep ~4.5.0
  • @commitlint/cli 15.0.0
  • coveralls 3.1.1
  • intelli-espower-loader 1.1.0
  • mocha 9.1.3
  • nyc 15.1.0
  • power-assert 1.6.1
  • standard-version 9.3.2
travis
.travis.yml
  • node 12
  • node 14
  • node 16
  • node 17

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.