Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments not being removed (parserPreset necessary?) #846

Open
2 of 4 tasks
CrispyDrone opened this issue Nov 2, 2019 · 0 comments
Open
2 of 4 tasks

Comments not being removed (parserPreset necessary?) #846

CrispyDrone opened this issue Nov 2, 2019 · 0 comments
Labels

Comments

@CrispyDrone
Copy link

CrispyDrone commented Nov 2, 2019

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)

  1. Install @commitlint/cli, @commitlint/config-conventional (and optionally my plugin commitlint-plugin-cleanfeet)
  2. Remove parserPreset (since this currently results in a module not found error, see other issue)
  3. Add any lines starting with # when using git 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants