34

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.

4

2 回答 2

33

laxbreak正如答案的评论中所提到的,laxcomma实际上应该将选项用于这种特殊情况(同时已经实施)。有关详细信息,请参阅http://jshint.com/docs/options/

于 2012-08-02T16:31:50.723 回答
14

laxbreak = true is the option to set.

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

于 2011-12-18T02:23:41.037 回答