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

隐身守侯 提交于 2019-12-03 14:31:30

问题


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.


回答1:


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.




回答2:


laxbreak = true is the option to set.

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



来源:https://stackoverflow.com/questions/8549394/how-do-i-configure-jshint-to-not-give-me-the-error-bad-line-breaking-before

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!