capitalized-comments' ignorePattern should default to no-fallthrough's commentPattern
See original GitHub issueTell us about your environment
- ESLint Version: 5.2.0
- Node Version: v8.9.4
- npm Version: 5.6.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
{
"env": {
"browser": true,
"es6": true,
"greasemonkey": true
},
"extends": "eslint:recommended",
"globals": {
"player": false,
"PLAYER_STATE": false
},
"rules": {
"no-fallthrough": [
"error", {
"commentPattern": "fall\\-through"
}
],
"capitalized-comments": "error"
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
var playerState = player.getPlayerState();
switch (playerState) {
case PLAYER_STATE.Unstarted: // fall-through
case PLAYER_STATE.Ended: // fall-through
case PLAYER_STATE.Paused: // fall-through
case PLAYER_STATE.Buffering: // fall-through
case PLAYER_STATE.VideoCued: {
player.playVideo();
break;
}
}
eslint scripts/**/*
What did you expect to happen?
capitalized-comments
should have been loaded the ignorePattern
(that I didn’t set) from the no-fallthrough
’s commentPattern
option, as it’s clear I’d be using that fall through pattern.
What actually happened? Please include the actual, raw output from ESLint.
.../scripts/Main/main.js
4:34 error Comments should not begin with a lowercase character capitalized-comments
5:30 error Comments should not begin with a lowercase character capitalized-comments
6:31 error Comments should not begin with a lowercase character capitalized-comments
7:34 error Comments should not begin with a lowercase character capitalized-comments
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
capitalized-comments - ESLint - Pluggable JavaScript Linter
ignorePattern : A string representing a regular expression pattern of words that should be ignored by this rule. If the first word of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No worries – I just meant that it’s hard for me to predict how ESLint will change in the distant future.
Yes, I’ll go ahead and close it. We definitely appreciate you creating the issue!
To avoid duplication in your config, one option would be to use an
.eslintrc.js
file and use variables:Hi, thanks for the issue. ESLint rules can’t know about each other by design, so this is not something
capitalized-comments
can do. A solution for this is to use thecapitalized-comments
rule’signorePattern
option:I don’t think adding a case by default for the
no-fallthrough
comment is desirable here for two reasons:no-fallthrough
, thecapitalized-comments
rule could be ignoring comments it shouldn’t beEdit: Typo, meant to type
no-fallthrough
comment.