Repository: conventional-changelog/commitlint

Issue #445: Different results from the same commit message between cli and actual commit
Created: 2018-09-16T15:16:52Z
Expected Behavior


Below two commands should be passed in my config. At least the same result should be output.
$ cat .git/COMMIT_EDITMSG | npx commitlint
$ git commit -m "chore(component,demo): bump"
Current Behavior


$ cat .git/COMMIT_EDITMSG | npx commitlint
⧗   input: chore(component,demo): bump
✔   found 0 problems, 0 warnings
Above command passed but below failed.
$ git commit -m "chore(component,demo): bump"
husky > commit-msg (node v8.12.0)
.git/COMMIT_EDITMSG
⧗   input:
chore(component,demo): bump

✖   scope may not be empty [scope-empty]
✖   message may not be empty [subject-empty]
✖   type may not be empty [type-empty]
✖   found 3 problems, 0 warnings
husky > commit-msg hook failed (add --no-verify to bypass)

Affected packages

[?] cli
[?] core
[?] prompt
[?] config-angular

Possible Solution


Steps to Reproduce (for bugs)









  commitlint.config.js
  
  
```js
```

Context


Your Environment

package.json:
{
  "name": "root",
  "private": true,
  "devDependencies": {
    "husky": "^1.0.0-rc.14",
    "js-combinatorics": "^0.5.3",
    "lerna": "^3.3.1",
    "wsrun": "^2.2.1"
  },
  "workspaces": [
    "packages/*"
  ],
  "dependencies": {
    "@babel/cli": "^7.0.0",
    "@babel/core": "^7.0.1",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "@commitlint/cli": "^7.1.2",
    "@commitlint/config-conventional": "^7.1.2",
    "babel-eslint": "^9.0.0",
    "eslint": "^5.5.0",
    "eslint-plugin-react": "^7.11.1"
  },
  "husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
    }
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/b6pzeusbc54tvhw5jgpyw8pwz2x6gs/react-utterances.git"
  }
}
// commitlint.config.js
const Combinatorics = require('js-combinatorics')

const scopeList = ['root','component','demo']
const scopeEnumList = []

Combinatorics.power(scopeList).forEach( subset => {
  if( subset.length < 1 ) return

  const isAll = subset.length === scopeList.length
  scopeEnumList.push( isAll ? 'all' : subset.join(','))
})

module.exports = {
  rules: {
    'body-leading-blank': [1, 'always'],
    'footer-leading-blank': [1, 'always'],
    'header-max-length': [2, 'always', 72],
    'scope-case': [2, 'always', 'lower-case'],
    'scope-enum': [2, 'always', scopeEnumList],
    // scopeEnumList: [ 'root',  'component',  'root,component',  'demo',  'root,demo',  'component,demo',  'all' ]
    'scope-empty': [2, 'never'],
    'subject-case': [2, 'never', ['sentence-case','start-case','pascal-case','upper-case']],
    'subject-empty': [2, 'never'],
    'subject-full-stop': [2, 'never', '.'],
    'type-case': [2, 'always', 'lower-case'],
    'type-empty': [2, 'never'],
    'type-enum': [2, 'always', ['build','chore','ci','docs','feat','fix','perf','refactor','revert','style','test','dx']],
  }
}
version:
$ npx commitlint --version
7.1.2
$ git --version
git version 2.15.2 (Apple Git-101.1)
$ node --version
v8.12.0

Duplicate issue #399: Chinese scopes cause error
Created: 2018-07-25T07:37:20Z
Expected Behavior


Chinese scopes acceptable
Current Behavior


Chinese scopes cause error
husky > npm run -s commitmsg (node v9.8.0)
⧗   input:
fix(面试评价): 测试
✖   message may not be empty [subject-empty]
✖   type may not be empty [type-empty]
✖   found 2 problems, 0 warnings
husky > commit-msg hook failed (add --no-verify to bypass)
If scope is English, e.g.: fix(english): 测试, lint will pass
Affected packages

 cli
 core
 prompt
 config-angular

Possible Solution


Steps to Reproduce (for bugs)









  commitlint.config.js
  
  
module.exports = {
  extends: ['@commitlint/config-conventional'],
  rules: {
    'type-enum': [2, 'always', [
      'feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'build', 'ci', 'chore', 'revert',
    ]],
    'scope-enum': [2, 'always', [
      '面试评价', '需求审批', '简历筛选',
    ]],
    'scope-case': [0],
    'subject-case': [0],
  },
};

Context


Your Environment




Executable
Version




commitlint --version
6.2.0


git --version
2.15.2


node --version
9.8.0

Closing comment (2018-11-25T19:58:19Z): Investigating if this is related to #445, #341