how to disable the "laxcomma" check?
Asked Answered
P

2

10

I'm using SublimeLintern package, but I'm experiencing some issues. I would like to toggle that "laxcomma" warning that appears each time I save my files: I do prefer putting my commas at the beginning of each row

{
  "item1": val1
  ,"item2": val2
  ,"item3": val3
}

Hence, I tried to look for some piece of documentation that explained how to enable or disable each check. I bumped into this that should explain what I need. So, my SublimeLinter.sublime-settings is now like this:

{
    "jshint_options": {
        "laxcomma": false
    }
}

but it doesn't seem to be working. I still see that bothering warning! What's wrong with my settings?

Parton answered 18/9, 2013 at 21:1 Comment(4)
Have you looked at lines 284 and 285 of /Packages/SublimeLinter/sublimelinter/modules/libs/jshint/jshint.js? You might want to set laxbreak and laxcomma to false.Gearard
Yep! I've tried both, but nothing happensParton
May you try this out on your SBT2 sublimelinter.sublime-settings file and tell me if it works properly? In case it works: may you paste a gist here? ThanksParton
Is this still relevant? I do get warning for comma at the beginning of each line rather than end! But code seems to work fine on pretty much all browsers!Hanzelin
W
4

Bizarre. For me, the issue was that I had a .jshintrc file in the local directory of my project. Despite the fact that laxcomma wasn't being overridden there EITHER, apparently it just completely overrides your jshint_options (or maybe it does a top-level extend and doesn't recursively merge the config objects...)

The solution was to add (to the local .jshintrc file):

"laxcomma": true

Wing answered 13/1, 2014 at 0:6 Comment(4)
And in a simple command you can do bash$:> echo '"laxcomma": true' >> ~/.jshintrcStormie
doesn't work for me. maybe i need to restart webstorm?Horseshoes
@Horseshoes yeah maybe quit out of it completely and open it again-- my solution isn't necessarily a surefire fix for your situation, since it does seem that this stuff is a bit editor-dependentWing
My project had more than one version of this file. :)Horseshoes
E
1

The word "lax" means not strict or severe; if you want to put your commas at the beginning of each line, try setting "laxcomma" to true:

{
    "jshint_options": {
        "laxcomma": true
    }
}
Elma answered 27/9, 2013 at 14:7 Comment(2)
this is part of my .sublime-project content "jshint_options": { "laxcomma": true } I tried with both true and false but nothing happens, this is the message I get after saving my file: 'comma warnings can be turned off with 'laxcomma'; bad line breaking before ',' I don't know the cause of that bad line breaking actually.Parton
Correct for 'The word "lax" means not strict or severe'Granule

© 2022 - 2024 — McMap. All rights reserved.