DEV Community

Discussion on: A New Coding Style for Switch Statements in JavaScript/TypeScript

Collapse
 
liamfd profile image
Liam Doran • Edited

Great tip! I've landed on a similar practice informed by eslint's no-case-declaration rule.

Typically I default to cases without blocks, and add them when that rule reminds me to.

Collapse
 
nebrius profile image
Bryan Hughes

That’s a nice approach too, as it also removes the “whoops I didn’t realize I did that” effect. Good to know, thanks!