Reputation: 16335
I use jshint.vim and in the code like below I get an error "bad line breaking before ','"
var a = 5
, b = 10;
How can I fix this? I found this question, but I'm not sure how can I use it to fix the problem in Vim. Is there any config file (except .vimrc) where I can set laxbreak
or laxcomma
?
Upvotes: 3
Views: 1533
Reputation: 25728
I'm not sure about global configurations for the vim implementation, you'd have to consult the docs for that implementation, but you can put
/*jshint laxcomma:true */
at the top of your source files to set this on a per-file basis
Looks like for the vim implementation you can set the config file using a global variable:
https://github.com/walm/jshint.vim/pull/3
You can then just create a json file and set laxcomma:true
in it.
Upvotes: 3
Reputation: 1580
Yes. I often use a leading comma style, and set the following preferences inside ~/.jshintrc
:
{
//...other prefs
laxcomma : true,
laxbreak : true,
//... other prefs
}
If you don't already have a .jshintrc, those two settings enclosed in braces a la JSON will probably do the trick.
Upvotes: 6