conventional-changelog/commitlint

Can't work with emoji?

Open

#880 opened on Dec 23, 2019

View on GitHub
 (6 comments) (3 reactions) (0 assignees)TypeScript (15,497 stars) (896 forks)batch import
help wantedtriage

Description

Expected Behavior

I use npm run commit to generate commit message, I hope it will success generate commit message!

Current Behavior

I use npm run commit to generate commit message, but the commlint check always fails !😫

Affected packages

  • @commitlint/cli
  • commitizen
  • commitlint-config-cz
  • cz-customizable
  • husky

Possible Solution

I queried all documents and issess,I find maybe I need setting headerPattern

Steps to Reproduce (for bugs)

1.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"

.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
}

commitlint.config.js:

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

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:

Context

I guess Emoji (🐞 etc.) in my commit message causes it. but I don't know how to fix it. 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 !!

Your Environment

Executable Version
commitlint --version "^8.2.0"
git --version 2.20.1
node --version v10.15.3

repository

this is my repository

Contributor guide