简体   繁体   中英

How do I configure jshint to not give me the error “Bad line breaking before”?

It's giving me the error "Bad line breaking before ','" because I have code like the following

var one = 1
  , two = 2
  , three = 3
  ;

If I put the , at the end of the line instead of the beginning of the next, it doesn't complain. But I want to code this way. Is there a way I can make it not show this warning?

I looked though JSHint's options but there isn't anything pertaining to this error.

As mentioned in the comments of the laxbreak answer, laxcomma option should actually be used for this particular situation (it has been implemented in the meantime). See http://jshint.com/docs/options/ for details.

laxbreak = true is the option to set.

You can find the option on the main page of JSHint site as "About unsafe line breaks" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM