I had the same issue and was able to overcome it by adding this section to my package.json, which configures commitlint to use config-conventional.
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
Also ensure that you installed both dev dependencies.
"@commitlint/cli": "18.0.0",
"@commitlint/config-conventional": "18.0.0",
You can find this also in the commitlint projects package.json. ;- )
https://github.com/conventional-changelog/commitlint/blob/master/package.json
» npm install @commitlint/config-conventional
Issue with CommitLint: "Please add rules to your `commitlint.config.js`" error despite having rules in my configuration file
node.js - commitlint config-conventional - Add prefix for commit messages - Stack Overflow
Automating Releases in GitHub with Conventional Commits
Commit message linting within Magit?
Videos
I had the same issue and was able to overcome it by adding this section to my package.json, which configures commitlint to use config-conventional.
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
Also ensure that you installed both dev dependencies.
"@commitlint/cli": "18.0.0",
"@commitlint/config-conventional": "18.0.0",
You can find this also in the commitlint projects package.json. ;- )
https://github.com/conventional-changelog/commitlint/blob/master/package.json
This is my dependency package
"devDependencies": {
"@commitlint/cli": "^19.7.1",
"@commitlint/config-conventional": "^19.7.1",
"@types/node": "18.18.13",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"husky": "^9.1.7"
}
You can try changing the file name of commitilint.config. js to commitilint.config. cjs
// commitlint.config.cjs
module.exports = {
extends: ['@commitlint/config-conventional']
}
Please also note that the file encoding is utf-8
» npm install @open-turo/commitlint-config-conventional
You can use this package https://github.com/Gherciu/commitlint-jira it works good out of the box with Jira commits style ;)
For Tips and Advanced Usage you can read this Blog Post
The default header shape is as follows (docs ref):
module.exports = {
parserOpts: {
headerPattern: /^(\w*)\((\w*)\)-(\w*)\s(.*)$/,
headerCorrespondence: ['type', 'scope', 'ticket', 'subject'],
},
};
You can set the header with any other shape you need, for example:
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-empty': [2, 'always'],
'scope-empty': [2, 'always'],
},
parserPreset: {
parserOpts: {
headerPattern: /^(JIRA-[0-9]{2,4}):(.+)$/,
headerCorrespondence: ['ticket', 'subject'],
}
}
};