Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule no-case-declarations #137

Merged
merged 1 commit into from
Aug 13, 2019

Conversation

justinkalland
Copy link
Contributor

@justinkalland justinkalland commented Dec 20, 2018

@justinkalland
Copy link
Contributor Author

Rule addition now has no impact.

1..186
# tests 186
# pass  186

# ok

@feross
Copy link
Member

feross commented Aug 13, 2019

One repo started failing, but I PR'd it: zensh/resp.js#3

@feross
Copy link
Member

feross commented Aug 13, 2019

Let's ship this in standard v14

@feross feross merged commit 209c09e into standard:master Aug 13, 2019
Copy link
Member

@mightyiam mightyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, wow. I didn't even realize that the code after case foo: is not a block. And that I could simply add a block there. Lovely. Excellent rule, it seems.

@feross
Copy link
Member

feross commented Aug 13, 2019

@mightyiam Yeah, this blew my mind as well when I discovered it. Now I always use blocks in case statements.

@feross
Copy link
Member

feross commented Aug 13, 2019

@justinkalland Btw, thanks for the pull request! You're awesome! 🤩

giphy

@ungoldman
Copy link

Just discovered this rule from upgrading to standard 14 and grumbled until I read https://eslint.org/docs/rules/no-case-declarations and learned something new. Thank you! I feel like each of these rules deserves its own class or blog or something, so much to learn about here. Okay good night 👋

@feross
Copy link
Member

feross commented Oct 31, 2020

@ungoldman Indeed! Perhaps we can add such explanations to the RULES.md file!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

enable rule no-case-declarations to prevent usage of undeclared variables
6 participants