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

White space and indent errors not being displayed #79

Closed andyperlitch closed 10 years ago

andyperlitch commented 10 years ago

Great plugin, very useful!

I am having an issue though with trailing white space and indentation. Say I have a test.js file:

'use strict';

var test = 'test';

function doSomething() { 
// Trailing white space ^

    console.log(test);
// ^ improper indent
}

doSomething();

...and a .jshintrc:

{
  "node": true,
  "browser": true,
  "bitwise": true,
  "camelcase": false,
  "curly": true,
  "eqeqeq": true,
  "immed": true,
  "indent": 2,
  "latedef": true,
  "newcap": false,
  "noarg": true,
  "quotmark": "single",
  "regexp": true,
  "undef": true,
  "unused": true,
  "strict": true,
  "trailing": true
}

When I run jshint test.js, I get the two expected errors (white space and indentation). But when I run your plugin, I get no errors. I made this use-case into a little repo so you could clone and test yourself: https://github.com/andyperlitch/sublime-jshint-bug.

My sublime linting preferences are as follows (don't think I have changed anything from defaults):

{
  // Details: https://github.com/victorporof/Sublime-JSHint#using-your-own-jshintrc-options
  // Example: https://github.com/jshint/jshint/blob/master/examples/.jshintrc
  // Documentation: http://www.jshint.com/docs/
  "browser": true,
  "esnext": true,
  "globals": {},
  "globalstrict": true,
  "quotmark": true,
  "smarttabs": true,
  "trailing": true,
  "undef": true,
  "unused": true
}

Thanks in advance! Sorry if this is a duplicate or known bug!

EDIT: I am on Sublime Text 2, build 2221.

victorporof commented 10 years ago

Thanks for the report. Where do you keep your .jshintrc? EDIT: ok, now I see it's right near the linted file.

I'll clone this and see what happens.

andyperlitch commented 10 years ago

The root of my repository (like in the example repo i just put up). Were you able to recreate by cloning https://github.com/andyperlitch/sublime-jshint-bug and running it yourself?

victorporof commented 10 years ago

Yup, I can reproduce this. What version of jshint were you using when running jshint test.js in the terminal?

andyperlitch commented 10 years ago
$ jshint -v
jshint v2.3.0
victorporof commented 10 years ago

Thanks!

andyperlitch commented 10 years ago

Thank you for being so responsive!

victorporof commented 10 years ago

I updated jshint to v2.5.2 (latest). This plugin uses something relatively recent as well. When using it myself from the command line, jshint test.js from your repo, I get no output. This looks like a jshint bug!

victorporof commented 10 years ago

It actually looks like trailing is a removed option now :( Changeset: https://github.com/jshint/jshint/commit/0c0e19319b276b019d285bdfd2cfc49126abd814

andyperlitch commented 10 years ago

very interesting... I suppose i'm okay with no longer having trailing, but it isn't catching the indents either?? Lame.

victorporof commented 10 years ago

Maybe file a bug/request on the jshint repo?

andyperlitch commented 10 years ago

Check it out: https://github.com/jshint/jshint/issues/1677