3

I've been trying to configure SublimeLinter to use different JSHint settings, but my settings are being totally ignored. Mostly I just want to be able to use double quotes without getting a linting error. Here's what I have in my 'User' SublimeLinter.sublime-settings

{
    "jshint_options":
    {
        "evil": true,
        "regexdash": true,
        "browser": true,
        "wsh": true,
        "sub": true,
        "quotmark" : true
    }
}

The file is definitely being parsed, as it throws an error whenever it's not properly formatted (amusingly this includes whenever the strings are wrapped in single quotes). It's also ignoring more than just the quote preference- I can set "evil" to false and it'll still give me eval warnings.

Any ideas? This is on OSX.

Thanks in advance.

Godwhacker
  • 3,624
  • 3
  • 15
  • 23
  • Is it definitely configured to use JSHint (instead of JSLint)? Also note that the `quotmark` option takes a string (in your case `"double"` if you want to enforce the use of double quotes). – James Allardice Nov 04 '13 at 15:23
  • [`evil`](http://www.jshint.com/docs/options/#evil) is an option you "relax", meaning JSHint warns you about using `eval` by default and setting `"evil": true` will disable the warning. – Ross Allen Nov 04 '13 at 19:56

3 Answers3

3

FYI just in case: jshint_options is no longer available on SublimeLinter-jshint and settings are now set with .jshintrc files. See this and this.

Community
  • 1
  • 1
Ben Creasy
  • 3,825
  • 4
  • 40
  • 50
2

I had the exact same problem. The default .jshintrc in "sublime/preferences/package settings/js hint/set linting preferences" did absolutely nothing for me either.

In order to fix it, I created a .jshintrc file in the root folder of the web project I was working on. I then opened the folder through sublime text and sublinter/jshint picked up my settings.

Pang
  • 9,564
  • 146
  • 81
  • 122
Harry Fairbanks
  • 408
  • 1
  • 4
  • 13
1

Maybe your Jshint options are overridden by a .jshinrc file. According to SublimeLinter README file :

SublimeLinter supports .jshintrc files. If using JSHint, SublimeLinter will recursively search the directory tree (from the file location to the file-system root directory). This functionality is specified in the JSHint README.

and

The jshint follows convention set by node-jshint (though node is not required) and will attempt to locate the configuration file for you starting in pwd. (or "present working directory") If this does not yield a .jshintrc file, it will move one level up (..) the directory tree all the way up to the filesystem root. If a file is found, it stops immediately and uses that set of configuration instead of "jshint_options".