no-fallthrough rule's bypass comment behavior isn't intuitive when case followed by curly braces #9080
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
enhancement
This change enhances an existing feature of ESLint
evaluating
The team will evaluate this issue to decide whether it meets the criteria for inclusion
rule
Relates to ESLint's core rules
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
Default parser
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
The last switch example will not cause a lint error.
What actually happened? Please include the actual, raw output from ESLint.
The last switch example does cause a lint error.
some of my views
Maybe the rules now only check if there is a bypass comment in the line JUST before each
case
, keyword, but I like to enclose around the case code with curly braces, so the rule doesn't recognize the bypass comment.But, IMHO, when enclose with curly braces, bypass comment written in the last line in the, let's say, BLOCK of the first
case
is more intuitive. (last example)So maybe we can change the rule to determine whether the last sentence in the BLOCK of the first
case
is bypass comment?This change is backward compatible, because when there is no curly braces, the last sentence of the first
case
's BLOCK is also the prev line of the secondcase
, because the BLOCK is all sentences of firstcase
, in this situation.Any comments is welcome, except for "why you like to add braces after
case
".:)
The text was updated successfully, but these errors were encountered: