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

Allow line breaking before && or || #60

Closed
arian opened this issue Feb 24, 2011 · 7 comments
Closed

Allow line breaking before && or || #60

arian opened this issue Feb 24, 2011 · 7 comments

Comments

@arian
Copy link

arian commented Feb 24, 2011

For multiple line conditions it might be more readable if the && and || are at the beginning of the line. JSHint however does not allow this, resulting in the error "Bad line breaking before '&&'."

if (a
    && b
    && c
    && (
        d
        || e
    )
){
    /* yay! */
}

Example: http://jsfiddle.net/AkeF3/1/

@Raynos
Copy link
Contributor

Raynos commented Feb 24, 2011

This may cause problems like semi colon insertion and old javascript parsers breaking. Please check a large range of browsers.

@valueof
Copy link
Member

valueof commented Feb 24, 2011

You can use laxbreak:true to bypass line breaking checks.

@robotlolita
Copy link

@Raynos are there seriously any parser that deviate that much from the spec?

@ghost
Copy link

ghost commented Feb 23, 2015

👍

@Rob--W
Copy link
Contributor

Rob--W commented May 29, 2015

This error is still in 2.7.0.

I added "-W014": true to .jshintrc to get rid of this error (

W014: "Bad line breaking before '{a}'.",
).

@ghost
Copy link

ghost commented Jun 24, 2015

@Raynos : Can you recommend a resource for which JS parsers might meet this failure?

This may cause problems like semi colon insertion and old javascript parsers breaking. Please check a large range of browsers.

@jcrben
Copy link

jcrben commented Nov 10, 2015

Why was this closed? Is it considered a duplicate of #735?

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

No branches or pull requests

6 participants