conventional-changelog / commitlint

📓 Lint commit messages
https://commitlint.js.org
MIT License
16.62k stars 891 forks source link

fix: commit fail about 'type may not be empty' and 'subject may not be empty' with gitmoji #3430

Closed seepine closed 1 year ago

seepine commented 1 year ago

Expected Behavior

commit success

Current Behavior

→ No staged files match any configured task.
⧗   input: :rocket: build(deps): upgrade arco
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

husky - commit-msg hook exited with code 1 (error)
git exited with error code 1

Affected packages

Possible Solution

No response

Steps to Reproduce

package.json

{

  "devDependencies": {
    "@commitlint/cli": "~17.3.0",
    "@commitlint/config-conventional": "~17.3.0",
    "commitizen": "~4.2.4",
    "commitlint-config-gitmoji": "^2.2.6",
    "conventional-changelog-gitmoji-config": "^1.4.4",
  }
}

commitlint.config.js

module.exports = { extends: ['@commitlint/config-conventional', 'gitmoji'] }

.cz-config.js

module.exports = {
  // type 类型(定义之后,可通过上下键选择)
  types: [
    { value: ':bug: fix', name: '🐛 fix:       fix bug' },
    { value: ':sparkles: feat', name: '✨  feat:     feat func' },
    { value: ':rocket: build', name: '🚀 build:      xxxxx' },
  ]
}

Context

No response

commitlint --version

@commitlint/cli@17.3.0

git --version

git version 2.37.1 (Apple Git-137.1)

node --version

v16.13.1

escapedcat commented 1 year ago

This might duplicate #880, right?
For gitmoji usage please have a look at this project: https://github.com/arvinxx/gitmoji-commit-workflow