Make no-case-declarations rule fixable
See original GitHub issueWhen error is spotted, fix will be about wrapping case
clauses with blocks. It’ll be great to have it.
What rule do you want to change?
no-case-declarations
Does this change cause the rule to produce more or fewer warnings?
No
How will the change be implemented? (New option, new default behavior, etc.)?
Fix functionality will be configured
Please provide some example code that this change will affect:
Code as:
switch (foo) {
case "bar":
let bar;
}
Will be fixed to:
switch (foo) {
case "bar": {
let bar;
}
}
What does the rule currently do for this code?
There’s no fix functionality configured
What will the rule do after it’s changed?
Fix functionality will be configured
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
no-case-declarations - ESLint - Pluggable JavaScript Linter
This rule aims to prevent access to uninitialized lexical bindings as well as accessing hoisted functions across case clauses. Examples of incorrect code...
Read more >eslint - unexpected lexical declaration in case block
1. deleteInterests is still a reference to the array in state so you're still mutating. Clone the list before splicing. · 2. Use...
Read more >Exclude eslint rule no-case-declarations [#2915263] | Drupal.org
Proposed resolution. Turn off no-case-declarations until the problem files are fixed.
Read more >Enable "no-case-declarations" · ab48e08d61 - eslint-config ...
This rule disallows lexical declarations in case statements. http://eslint.org/docs/rules/no-case-declarations Change-Id: ...
Read more >no-case-declarations - ESLint Config
This rule aims to prevent access to uninitialized lexical bindings as well as accessing hoisted functions across case clauses.
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 Free
Top 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
@ljharb Sure indentation should be maintained, this fix should be purely about adding block wrap nothing more (I’ve updated example)
Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn’t get enough support from the team and so I’m closing it. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach consensus after a long time tend to never do it, and as such, we close those issues. This doesn’t mean the idea isn’t interesting, just that it’s not something the team can commit to.