conventional-changelog / conventional-changelog/commitlint
Cannot get commitlint to run when using lint-staged and cz-customizable
- Dominant language
- TypeScript
- Stars
- 18.7k
- Forks
- 970
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 49
Description
## Expected Behavior
When using `yarn commit` the expected result is to run `lint-staged` to lint all js and css files; then `git-cz` to generate a commit message; and finally `commitlint` to ensure that the scope and subject fields are formatted correctly.
## Current Behavior
Both `lint-staged` and `git-cz` run correctly and in the correct order, but `commitlint` is never triggered.
## Affected packages
* [x] cli
* [x] core
* [x] prompt
* [ ] config-angular
## Steps to Reproduce (for bugs)
1. Add `"commit": "lint-staged && git-cz --no-verify",` as a script in package.json.
2. In your `.lintstagedrc` file, add the following config:
```
{
"*.js": [
"pretty-quick --staged",
"eslint src/ --fix",
"git add",
"eslint --fix"
],
"*.css": [
"stylelint src/ --fix",
"git add"
]
}
```
3. In your `.huskyrc` file, add the following config:
```
{
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
```
4. Finally, in your `.commitlintrc.js` file, add the following config items:
```
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-case': [2, 'always', 'lower-case'],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [2, 'always', 'lower-case'],
}
};
```
commitlint.config.js
```js
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-case': [2, 'always', 'lower-case'],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [2, 'always', 'lower-case'],
}
}
```
## Context
My absolute goal is to run `lint-staged`, then `git-cz`, then `commitlint` any time you run `yarn commit`.
## Your Environment
My project was started with `create-react-app` and has not been ejected. I’ve not even added any components yet — I’m just trying to get a solid, baseline codebase to start building on. Getting all of these tools to work well together has been tricky.
| Executable | Version |
| ---: | :--- |
| `@commitlint/cli` | 8.1.0 |
| `@commitlint/config-conventional` | 8.1.0 |
| `git --version` | 2.20.1 (Apple Git-117) |
| `node --version` | 12.6.0 |
| `commitizen` | 4.0.3 |
| `cz-conventional-changelog` | 3.0.2 |
| `cz-customizable` | 6.2.0 |
| `husky` | 3.0.1 |
Contributor guide
Assessment
This issue has not been assessed yet.