victorporof / Sublime-JSHint

JSHint Gutter for Sublime Text 2 and 3 via node.js
https://github.com/victorporof/Sublime-JSHint
682 stars 71 forks source link

Sublime-JSHint gives different errors from shell-invoked jshint (same version 2.9.1) #126

Closed cleverplatypus closed 8 years ago

cleverplatypus commented 8 years ago

Sublime-JSHint doesn't give the same outcome as the globally installed jshint executable.

In particular, some syntax errors are overlooked and I get an error for some directives like // jshint ignore: line

Incompatible values for the 'undefined' of 'undefined' linting options

The versions seem to match,

$ which jshint
/usr/local/bin/jshint

$ jshint -v
jshint v2.9.1

$ node -v
v0.10.35

$ grep version JSHint\ Gutter/scripts/node_modules/jshint/package.json
"type": "version"
"version": "2.9.1"

Any particular reason? Cheers

victorporof commented 8 years ago

There is a default set of settings added by the plugin. See .jshintrc file bundled, or right click -> jshint -> edit plugin settings.

mmeisel commented 8 years ago

I think this should be reopened, I'm also seeing the error "Incompatible values for the 'undefined' of 'undefined' linting options", which isn't present at the command line, for the jshint comment at the top of my file. In my case, it's:

/*jshint node:true */
hc-12 commented 8 years ago

@mmeisel as mentioned. I too also see the following error:

Incompatible values for the 'undefined' of 'undefined' linting options

I've changed run.js from line 197 to:

      if (e.raw) {
        // var message = e.raw
        //   .replace("{a}", e.a)
        //   .replace("{b}", e.b)
        //   .replace("{c}", e.c)
        //   .replace("{d}", e.d);
          var message = e.reason;

Which gives me the real error: Incompatible values for the 'esversion' of 'esnext' linting options

As it turns out you cannot use: esversion: 6

with

esnext: true

EDIT: To clarify, this error could well be caused by merging of default .jshintrc file with local .jshintrc options.

joshguptill commented 8 years ago

I had the same problem, but I closed and restarted sublime (after commenting out the built in jshintrc rules) and that error went away.

huexotzinca commented 7 years ago

I had the same problem; and like say @hc-12 you must be check your .jshinrc file in your project or file directory and the Packages/JSHint Gutter/.jshintrc ( you can access to this file through Rigth click > JSHint > Set Linting Preferences ) for incompatibility.