-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
archived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyESLint is working incorrectlyevaluatingThe team will evaluate this issue to decide whether it meets the criteria for inclusionThe team will evaluate this issue to decide whether it meets the criteria for inclusionruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
What version are you using?
v4.9.0
What did you do?
Config:
{
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-fallthrough": [
"error",
{
"commentPattern": "falls?\\s?through|break"
}
]
}
}
Code:
const item = "Test string";
switch (typeof item) {
case "string": {
// Run as if it was a number (below)
// fallthrough
}
case "number": {
console.log(item);
break;
}
}
What happened?
Console (worked as intended):
Test string
ESLint:
Expected a 'break' statement before 'case'. (no-fallthrough)
What did you expect to happen?
The same as without curly brackets, right? Removing the first or all of the case brackets prevents ESLint from erroring out the no-fallthrough
message.
Code:
const item = "Test string";
switch (typeof item) {
case "string":
// Run as if it was a number (below)
// fallthrough
case "number":
console.log(item);
break;
}
The empty block looks good for consistency especially since I want to comment something and not "stack" the case statements on top of each other.
Metadata
Metadata
Assignees
Labels
archived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyESLint is working incorrectlyevaluatingThe team will evaluate this issue to decide whether it meets the criteria for inclusionThe team will evaluate this issue to decide whether it meets the criteria for inclusionruleRelates to ESLint's core rulesRelates to ESLint's core rules