-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived 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 incorrectlyrepro:yesIssues with a reproducible exampleIssues with a reproducible example
Description
Environment
ESLint version: 8.29.0
What parser are you using?
Default (Espree)
What did you do?
Configuration
module.exports = {
reportUnusedDisableDirectives: true,
rules: {
'no-fallthrough': 'error',
},
};
switch (test) {
case a:
hello();
// eslint-disable-next-line no-fallthrough
case b:
}
What did you expect to happen?
The rule report should be hidden and no "unused disable directive" warnings should be reported.
What actually happened?
An unused disable directive warning is reported
Participation
- I am willing to submit a pull request for this issue.
Additional comments
This default behaviour is problematic because if you run eslint --fix
, then eslint will remove the unused disable comment, causing no-fallthrough error.
I think that this occurs because the default comment regex will match the no-fallthrough
string
eslint/lib/rules/no-fallthrough.js
Line 11 in ad44344
const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/iu; |
IMO either the rule should ignore eslint-disable directives, or the default regex should be updated to ignore them to prevent this behaviour.
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived 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 incorrectlyrepro:yesIssues with a reproducible exampleIssues with a reproducible example
Type
Projects
Status
Complete