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

Switch/Case Falls Through Doesn't Apply If there are New Lines #2652

Closed
jtfairbank opened this issue Sep 1, 2015 · 3 comments
Closed

Switch/Case Falls Through Doesn't Apply If there are New Lines #2652

jtfairbank opened this issue Sep 1, 2015 · 3 comments
Labels

Comments

@jtfairbank
Copy link

This will not trigger the Expected a 'break' statement before 'case'. warning:

var restOfWeek = [];
switch(weekday) {
    case "Sunday":
        restOfWeek.push("Monday");
        /* falls through */
    case "Monday":
        restOfWeek.push("Tuesday");
        /* falls through */
    ...
}

However if I add newlines between the cases for readability the warning is triggered:

var restOfWeek = [];
switch(weekday) {
    case "Sunday":
        restOfWeek.push("Monday");
        /* falls through */

    case "Monday":
        restOfWeek.push("Tuesday");
        /* falls through */

    ...
}
@lukeapage lukeapage added the P2 label Sep 6, 2015
@lukeapage
Copy link
Member

confirmed.

@oiwn
Copy link

oiwn commented Sep 10, 2015

same

nicolo-ribaudo added a commit to nicolo-ribaudo/jshint that referenced this issue Sep 11, 2015
jugglinmike pushed a commit to jugglinmike/jshint that referenced this issue Sep 20, 2015
@jtfairbank
Copy link
Author

Thank you! :D

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

No branches or pull requests

3 participants