Description
I've been working on a plugin to validate footers, however it seems that comments (lines starting with #
) are not removed by the parser, perhaps because of a missing parser preset.
I found this issue #78 that mentions switching to a fork of the parser, but for some reason this doesn't seem to be working for me.
Expected Behavior
I would expect any comments to be stripped by the parser, such that they won't interfere with any rules.
Current Behavior
Currently the parser does not remove any comments, which means that the commit message template I'm using will make various rules fail. The standard output by git showing which files have been modified etc when writing a commit message using git commit
, are thus also present and will make certain rules fail.
Affected packages
- cli
- core
- prompt
- config-angular
Possible Solution
Any line starting with a #
should be stripped by the parser.
Steps to Reproduce (for bugs)
- Install
@commitlint/cli
,@commitlint/config-conventional
(and optionally my plugincommitlint-plugin-cleanfeet
) - Remove
parserPreset
(since this currently results in a module not found error, see other issue) - Add any lines starting with
#
when usinggit commit
commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
plugins: ['cleanfeet'],
rules: {
'footer-format': [
2,
'always',
[
'^BREAKING CHANGE: .*',
'^[a-zA-Z0-9-]+: .*',
'^[a-zA-Z0-9-]+ #.*'
]
],
'footer-max-occurrence-breaking-change': [2, 'always', { max: 1, regex: /^BREAKING CHANGE: .*$/ }]
}
};
Your Environment
Executable | Version |
---|---|
commitlint --version |
8.2.0 |
git --version |
2.16.1.windows.4 |
node --version |
v8.9.4 |