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/
This may cause problems like semi colon insertion and old javascript parsers breaking. Please check a large range of browsers.
You can use laxbreak:true
to bypass line breaking checks.
@Raynos are there seriously any parser that deviate that much from the spec?
:+1:
This error is still in 2.7.0.
I added "-W014": true
to .jshintrc
to get rid of this error (https://github.com/jshint/jshint/blob/e47168f5aa9576819830554f1b37dc0d49b76d31/src/messages.js#L90).
@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.
Why was this closed? Is it considered a duplicate of https://github.com/jshint/jshint/issues/735?
Most helpful comment
This error is still in 2.7.0.
I added
"-W014": true
to.jshintrc
to get rid of this error (https://github.com/jshint/jshint/blob/e47168f5aa9576819830554f1b37dc0d49b76d31/src/messages.js#L90).