Giter Site home page Giter Site logo

sublimelinter-jshint's Introduction

SublimeLinter-jshint

Build Status

This linter plugin for SublimeLinter provides an interface to jshint. It will be used with files that have the "JavaScript" syntax, or within <script> tags in HTML files.

Installation

SublimeLinter must be installed in order to use this plugin.

Please use Package Control to install the linter plugin.

Before installing this plugin, ensure that jshint (2.5.0 or later) is installed on your system. To install jshint, do the following:

  1. Install Node.js (and npm on Linux).

  2. Install jshint (or globally with -g):

    npm install jshint
    
  3. If you are using nvm and zsh, ensure that the line to load nvm is in .zshenv or .zprofile and not .zshrc.(reason: here and here)

Please make sure that the path to jshint is available to SublimeLinter. The docs cover troubleshooting PATH configuration.

Settings

You can configure jshint options in the way you would from the command line, with .jshintrc files. For more information, see the jshint docs. You may provide a custom config file by setting the linter’s "args" setting to ["--config", "/path/to/file"]. On Windows, be sure to double the backslashes in the path, for example ["--config", "C:\\Users\\Aparajita\\jshint.conf"].

Using with tabs

If you use tabs as your indentation, make sure you set the option indent: 1 in your .jshintrc file. If not the wrong sections of the code will be highlighted.

sublimelinter-jshint's People

Contributors

aparajita avatar braver avatar groteworld avatar iulo avatar kaste avatar mokkabonna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublimelinter-jshint's Issues

nested .jshintrc is ignored

imagine dirstructute

/
  server
     server.js
  config
     cfg.js
  client
    client.js
    .jshintrc
  .jshintrc

with separate config for client part. Console jshint use nested options, but sublime linter use root configuration.

Doesn't find "ALL" errors

It seems like it doesn't find all types of errors. For example, linting the following code produces no errors:

exports = module.exports = HTTPTransport;

var HttpResponseParser = require('./http_response_parser'),
  http = require('http'),
  url = require('url'),
  _ = require('underscore');

function HTTPTransport(logger) {
  this._logger = logger;
}

HTTPTransport.prototype.process = function process(reqObj, callback, err, cData) {
  var errResp,
    urlparts,
    requestHeaders,
    httpRequest,
    self;

  httpRequestObj = {
    'hostname': urlparts.hostname,
    'port': urlparts.port,
    'method': reqObj.method,
    'path': urlparts.path,
    'headers': requestHeaders
  };

  httpRequest.on('error', function (err) {
    var errResp = new ErrorResponse("", (err || {})
      .message, self.options.contenttype)
      .response;
    callback(400, {}, errResp);
  });

  httpRequest.end();
};

Console output

SublimeLinter: javascript enabled (using node.js)
58
error: No lint errors.

At the very least, it should complain about undefined variables such as httpRequestObj and ErrorResponse

Screenshots

Sublime linter is too happy!
image

JSHint.com not so much!
image

"args" settings seems to be ignored

The settings "args" for jshint seems to be not used in the call to jshint executable.

Here is my complete Packages\User\SublimeLinter.sublime-settings file:

{
    "user": {
        "debug": true,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "save only",
        "linters": {
            "csslint": {
                "@disable": false,
                "args": "",
                "errors": "",
                "excludes": [],
                "ignore": "",
                "warnings": ""
            },

            // =================
            "jshint": {
                "@disable": false,
                "args": "",
                "excludes": []
            },
            // =================

            "json": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "php": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "ruby": {
                "@disable": false,
                "args": [],
                "excludes": []
            }
        },
        "mark_style": "outline",
        "paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 0,
        "show_errors_on_save": true,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "php": "html"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

Using it, I get the following output on the console when a try to lint a JavaScript file, which looks normal:

SublimeLinter: jshint: test.js ['C:\\Users\\<username>\\AppData\\Roaming\\npm\\jshint.cmd', '--verbose', '*', '-'] 

If I add a --version to the args settings (just for test case), then the output is exactly the same:

"jshint": {
    "@disable": false,
    "args": "--version",
    "excludes": []
}
SublimeLinter: jshint: a.js ['C:\\Users\\<username>\\AppData\\Roaming\\npm\\jshint.cmd', '--verbose', '*', '-']

At the same time, it works well with csslint:

  • console output for "args": "":
SublimeLinter: csslint: a.css ('C:\\Users\\<username>\\AppData\\Roaming\\npm\\csslint.cmd', '--format=compact') 
SublimeLinter: csslint output:
c:\users\<username>\appdata\local\temp\tmpsisxo7.css: Lint Free! 
  • console output for "args": "--version":
SublimeLinter: csslint: a.css ('C:\\Users\\<username>\\AppData\\Roaming\\npm\\csslint.cmd', '--format=compact', '--version') 
SublimeLinter: csslint output:
v0.10.0 

I don't know what's wrong with JSHint. I've just installed SublimeLinter3 and linter today, from a fresh Packages folder so I don't think to have another settings elsewhere that would override this.
The workaround from #3 to put a .jshintrc in your home directory or the root directory. If there are no other .jshintrc files in the path, that will be used. could no fit to all situations, for example if you want a specific config file based on a Sublime projects.

does not discover .jshintrc in `../.jshintrc`

When I work with a javascript file like ./index.js when there is a ./.jshintrc right next to it as a sibling the sublimelinter jshint works as expected

It lints my javascript file with the jshintrc definition that's defined locally.

However when I work with a javascript file like ./lib/client.jswhen there is a./.jshintrc` above it in the file system then sublimelinter jshint doesnt work as expected

It lints my javascript file with the global jshint option defaults.

I believe the issue is that sublime linter reads the code to lint out of the text editor buffer and writes it over stdin to jshint.

We can pass a flag to jshint called --filename ( https://github.com/jshint/jshint/blob/master/src/cli.js#L21-L23 ) that allows jshint to know the filename path of the code being written to stdin.

jshint will then correctly use it's own config loading algorithm and pick up the jshintrc file.

I'm not sure where i can access to the filename and how to pass the command line argument in the linter implementation.

Error in inline configuration produces TypeError: object of type 'NoneType' has no len()

Example with error in inline configuration line:

/* global console, */
var x = function () {
"use strict";
console.log("foo");
};
x();

SublimeLinter debug output:
SublimeLinter: jshint output:
stdin: line 1, col 22, '' is defined but never used. (W098)

1 error
SublimeLinter: error in SublimeLinter daemon:
SublimeLinter: --------------------
SublimeLinter: Traceback (most recent call last):
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/queue.py", line 58, in loop
item = self.q.get(block=True, timeout=self.MIN_DELAY)
File "X/queue.py", line 175, in get
queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/queue.py", line 66, in loop
self.lint(view_id, timestamp)
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/queue.py", line 112, in lint
self.callback(view_id, timestamp)
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/sublimelinter.py", line 121, in lint
Linter.lint_view(view, filename, code, hit_time, callback)
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 830, in lint_view
linter.lint(hit_time)
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 1233, in lint
for match, line, col, error, warning, message, near in self.find_errors(output):
File "/Users/Peter/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 1538, in find_errors
yield self.split_match(self.regex.match(line.rstrip()))
File "linter in /Users/Peter/Library/Application Support/Sublime Text 3/Installed Packages/SublimeLinter-jshint.sublime-package", line 107, in split_match
TypeError: object of type 'NoneType' has no len()

SublimeLinter: --------------------

nonbsp option causes error at end of files

Notice the error on the last line (no message):
JSHint nonbsp error in Sublime

My .jshintrc file:

{
    "browser": true,
    "devel": true,
    "eqnull": true,
    "camelcase": true,
    "eqeqeq": true,
    "freeze": true,
    "immed": true,
    "indent": 4,
    "latedef": true,
    "newcap": true,
    "noarg": true,
    "nonbsp": true,
    "nonew": true,
    "quotmark": "single",
    "undef": true,
    "unused": true,
    "strict": true,
    "trailing": true
}

Removing the nonbsp option eliminates the error.

UnboundLocalError: local variable 'executable' referenced before assignment

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 303, in on_activated
    callback.on_activated(v)
  File "/home/danny/.config/sublime-text-3/Packages/SublimeLinter/sublimelinter.py", line 266, in on_activated
    self.check_syntax(view)
  File "/home/danny/.config/sublime-text-3/Packages/SublimeLinter/sublimelinter.py", line 207, in check_syntax
    Linter.assign(view, reset=True)
  File "/home/danny/.config/sublime-text-3/Packages/SublimeLinter/lint/linter.py", line 650, in assign
    if not linter_class.disabled and linter_class.can_lint(syntax):
  File "X/functools.py", line 233, in wrapper
  File "/home/danny/.config/sublime-text-3/Packages/SublimeLinter/lint/linter.py", line 1414, in can_lint
    status = 'WARNING: {} deactivated, cannot locate \'{}\''.format(cls.name, executable)
UnboundLocalError: local variable 'executable' referenced before assignment

This does happen in the SublimeLinter plugin but only with the jshint plugin, htmltidy for example works flawlessly. I'm not to sure how to debug this.

See also: SublimeLinter/SublimeLinter#88

Wrong highlight of warning

I use js inside html file:

<script> function foo() { return 1; } </script>

Warning: 'Foo is defined, but never used' highlights only "ion" portion of "function", not a "function" itself.

Details about warning/error

I was just wondering if it's possible to find details about an specific warning or error with the plugin. It doesn't seem to output the entries on my console panel even though --verbose flag is activated.

Can't find jshint executable on windows

On windows (x64) node.js installs jshint as jshint.cmd not jshint which causes SublimeLinter to be unable to find the executable and therefore disable the linter.

The solution (for me) was to change:
cmd = 'jshint --verbose -'
to
cmd = 'jshint.cmd --verbose -'
in linter.py in the package folder

This may be more of an issue with SublimeLinter itself (should it do 'typical' windows searching for the file, without extension, and call any *.exe *.bat *.cmd ?)

I'll post this on the SublimeLinter repo in case that is the issue.

Sublime Text 3

Hi

I've been using Sublime Linter for a while and recently it has just stopped working. After spending countless hours trying to debug, I'm genuinely at a loss.

Hopefully you can help.

In my startup console, I see the following line, implying that jshint is disabled, how can I enable it?

SublimeLinter: jshint version query: /usr/local/bin/jshint --version
SublimeLinter: jshint version: 2.4.4
SublimeLinter: jshint: (>= 2.4.0) satisfied by 2.4.4
SublimeLinter: jshint activated: /usr/local/bin/jshint (disabled in settings)

Thanks!!

Add configuration to stop lint from jumping to first error

Working on a project with a lot of jshint errors that I can't tackle all it once. It really interrupts my flow when saving the file automatically jumps my cursor to the first error.

Is there a way to configure this linter to not jump my cursor straight to the error line?

WARNING: no jshint version could be extracted from: <BLANK>

I'm using ST3 under Windows 8.1 (x64) with node installed and set up in my path correctly. I'm trying to use this plugin, but it doesn't seem to do anything. I noticed this in my console output which presumably has something to do with it.

Any suggestions as to what do? The other linters I have installed work fine.

Point to a projects .jshintrc file?

I'm a bit confused with the new settings. How do I tell this linter to prefer the .jshintrc file of a project?

I've tried "args": ["--config .jshintrc"] with no luck.

Can I lint a directory/project?

I like the ability to find unused code, but a lot of my functions are being declared in file A, and called in file B.

I can't find anyway to look at both files for declarations/use.

Wrong highlighting

With this source:

/* global console */
/* global FOO */

"sole" in "console" in highlighted, and the space after "FOO" is highlighted.

Where do I put the jshint options now?

Hi there,

In the previous version I just added {"jshint_options": {<options>}} to the root of user settings file but the new user settings contain a lot more information and I'm not sure where to add the jshint options. would it be here {"user : { jshint_options": {<options>}}}?

Many thanks

Not following all rules

It appears as though the whitespace related rules ('indent', 'white') are not showing errors in the gutter. This is since I upgraded the package today, it used to work properly. It does trigger errors when I change the quotmark property, so I'm sure the .jshintrc file is loaded. Running sublime-text 3056 and the latest build through package control.

Moving the properties to the JSHint Gutter .jshintrc does not work either.

If I run jshint through grunt it does find the errors.

My .jshintrc file:

{
    "browser": true,
    "camelcase": true,
    "eqeqeq": true,
    "curly": true,
    "forin": true,
    "immed": true,
    "latedef": true,
    "newcap": true,
    "noarg": true,
    "indent": 4,
    "quotmark": "single",
    "undef": true,
    "unused": true,
    "trailing": true,
    "strict": true,
    "maxlen": 300,
    "white": true,
    "globals": {
        "define": true,
        "require": true
    }
}

ImportError: No module named 'SublimeLinter'

Installed the plugin using Package Control on Sublime 3, build 3062 (Linux) and I get this stack trace when it tries to load:

reloading plugin SublimeLinter-jshint.linter
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 73, in reload_plugin
m = importlib.import_module(modulename)
File "./importlib/init.py", line 90, in import_module
File "", line 1584, in _gcd_import
File "", line 1565, in _find_and_load
File "", line 1532, in _find_and_load_unlocked
File "/opt/sublime_text/sublime_plugin.py", line 671, in load_module
exec(compile(source, source_path, 'exec'), mod.dict)
File "linter in /home/pablo/.config/sublime-text-3/Installed Packages/SublimeLinter-jshint.sublime-package", line 14, in
ImportError: No module named 'SublimeLinter'

linter error when question mark at the end of a function name

It's not valid JavaScript, but the following will cause an error in the SublimeLinter daemon instead of returning a bunch of warnings. If other lint errors were already in the file they will remain unchanged. They will not update further because of the error. Closing and loading the file results it no lint errors reported to the user. With debug mode on the linter reports to the console, and the error occurs before sublime can report it to the user.

function something?() {
    linter="should complain about this ->"
}

using OSX 10.8.5, Sublime 3 stable 3059, SublimeLint 3.2.11, SublimeLinter-jshint 1.1.4, jshint v2.4.3, and the lint on save setting.

Problem with remote files

Works fine with local files, but on remote files(Samba) i get this error.

SublimeLinter: jshint: main.js ['C:\\Users\\UserName\\AppData\\Roaming\\npm\\jshint.cmd', '--verbose', '--config', '\\\\remotePath\\.jshintrc', '-'] 
SublimeLinter: error in SublimeLinter daemon: 
SublimeLinter: -------------------- 
SublimeLinter: Traceback (most recent call last):
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\queue.py", line 58, in loop
    item = self.q.get(block=True, timeout=self.MIN_DELAY)
  File "X/queue.py", line 175, in get
queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\queue.py", line 66, in loop
    self.lint(view_id, timestamp)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\queue.py", line 112, in lint
    self.callback(view_id, timestamp)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\sublimelinter.py", line 121, in lint
    Linter.lint_view(view, filename, code, hit_time, callback)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\linter.py", line 810, in lint_view
    linter.lint(hit_time)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\linter.py", line 1197, in lint
    output = self.run(cmd, self.code)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\linter.py", line 1483, in run
    return self.communicate(cmd, code)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\linter.py", line 1513, in communicate
    env=self.env)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\util.py", line 1064, in communicate
    return combine_output(out)
  File "C:\Users\UserName\AppData\Roaming\Sublime Text 3\Packages\SublimeLinter\lint\util.py", line 1044, in combine_output
    (out[1].decode('utf8') or '') if out[1] else '',
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 254: invalid start byte

Keys being ignored

I know this was an old issue that was closed but I'm still having problems.
Reference to the old issue: #36

I have those set in .jshintrc, user preferences and even js file.

In my case, "indent" is being ignored, also spacing in multi var and functions and onevar.
screen shot 2014-12-15 at 14 38 06

No module named 'SublimeLinter'

Having just updated all packages, I am getting the following error:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 73, in reload_plugin
    m = importlib.import_module(modulename)
  File "X/importlib/__init__.py", line 88, in import_module
  File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1023, in load_module
  File "<frozen importlib._bootstrap>", line 1004, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 869, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "/Users/ryanvangundy/Library/Application Support/Sublime Text 3/Packages/SublimeLinter-jshint/linter.py", line 14, in <module>
    from SublimeLinter.lint import Linter, util
ImportError: No module named 'SublimeLinter'

On a related note, there seems to be an issue with determining "SublimeLinter" vs. "SublimeLinter3". For example, ST3 is looking for the SublimeLinter general settings in Packages/SublimeLinter folder and is not finding it there--as the folder is actually Packges/SublimeLinter3.

If JS code indented with tabs, linter highlights wrong region

I'm not sure whether it's bug of SublimeLinter or SublimeLinter-jshint, but it's certainly not a bug of jshint itself.

To reproduce the issue, take JS file with some jshint issues, and change indentation to tabs.

This is what SublimeLinter shows:
selection_001

And this is output from jshint:

extension.js: line 198, col 35, Use '===' to compare with 'true'.
extension.js: line 196, col 24, 'wdith' is not defined.

If I switch indentation to spaces, everything is fine.

Stopped working

Love the linter! Suddenly it stopped working. I checked my "Package Settings" and no option for SublimeLinter. So I went to reinstall in Package Control and when I seached for "jshint" I got nothing. Any suggestions?

Linting jasmine files

Hi!

When using packages like Jasmine or Jasmine BDD they both support a custom syntax for the Jasmine spec library, the problem is that even if is still Javascript, the syntax name (or scopeName) is jasmine making the linter ignore the files.

So I was wondering if it could be added to the syntax tuple on this package or if there's a setting to support it.

Thanks!

Display message code / error identifier

I was looking for an error identifier and even though --verbose seemed on, it doesn't also show the message codes.
The console log:
SublimeLinter: jshint: test.js ['C:\\Users\\Me\\AppData\\Roaming\\npm\\node_modules\\.bin\\jshint.cmd', '--verbose', '--filename', '@', '-']

SublimeLinter Report:

test.js:

 jshint:
    12: Label 'javascript' on ( statement

Output when running from commandline:

jshint test.js --verbose
test.js: line 11, col 1, Label 'javascript' on ( statement. (W028)

I'd like that W028 shown too.

tab_width

I'm fairly sure the tab width for jshint is 4, and isn't set in the linter plugin (defaulting to 1).
This messes with the highlighting.
Without tab_width=4:

With:

The reported col is still off because it gets reported at the = rather than the end of the variable's name

SublimeLinter: WARNING: <linter> deactivated, cannot locate '<linter>'

I'm getting these messages in the console for both jshint & csslint

SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint'
SublimeLinter: WARNING: csslint deactivated, cannot locate 'csslint'

Both are already installed globally & work properly from the command line, so how can I fix this?

Look at the global ~/.jshintrc if no local found

featurerequest

According to the jshint docs, (see "Configuration"), a .jshintrc file is looked for in the current directory, then up through to the system root. This, for example, allows you to set a "default" .jshintrc file that is picked up by all projects. It would be great if this could support that.

Perhaps one avenue: instead of accessing the jshint binary directly, kick off a node script to use jshint?

error when trying to use jshint

Hi, I'm having some issues with Sublime Linter... thanks for any help you can provide. Both Sublime Linter and Sublime Linter -jshint are installed via Package Control.

node --version: v0.10.25

output of which % node (and npm):
/usr/local/bin/node
/usr/local/bin/npm

here is my console output when trying to use SublimeLinter - JShint

SublimeLinter: user shell: /bin/bash
SublimeLinter: computed PATH using /bin/bash:
/home/alfa/bin
/home/alfa/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games

SublimeLinter: jshint version query: /usr/local/bin/jshint --version
SublimeLinter: jshint version: 2.4.2
SublimeLinter: jshint: (>= 2.4.0) satisfied by 2.4.2
SublimeLinter: jshint activated: /usr/local/bin/jshint
SublimeLinter: WARNING: jsl deactivated, cannot locate ''
SublimeLinter: jshint: partwo.js ['/usr/local/bin/jshint', '--verbose', '--config', '/home/alfa/.jshintrc', '-']
SublimeLinter: jshint output:
shell.js: internal error
Error: EISDIR, illegal operation on a directory
at Object.fs.readSync (fs.js:476:19)
at Object.fs.readFileSync (fs.js:310:28)
at /usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:663:15
at Array.forEach (native)
at Object._cat (/usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:659:9)
at Object.cat (/usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:1491:23)
at Object.exports.loadConfig (/usr/local/lib/node_modules/jshint/src/cli.js:396:48)
at Object.exports.interpret (/usr/local/lib/node_modules/jshint/src/cli.js:511:21)
at Object. (/usr/local/lib/node_modules/jshint/bin/jshint:3:26)
at Module._compile (module.js:456:26)
Package Control: Skipping automatic upgrade, last run at 2014-01-24 16:05:58, next run at 2014-01-24 17:05:58 or after
Writing file /home/alfa/Documents/Javascript/partwo.js with encoding UTF-8 (atomic)
SublimeLinter: jshint: partwo.js ['/usr/local/bin/jshint', '--verbose', '--config', '/home/alfa/.jshintrc', '-']
SublimeLinter: jshint output:
shell.js: internal error
Error: EISDIR, illegal operation on a directory
at Object.fs.readSync (fs.js:476:19)
at Object.fs.readFileSync (fs.js:310:28)
at /usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:663:15
at Array.forEach (native)
at Object._cat (/usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:659:9)
at Object.cat (/usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:1491:23)
at Object.exports.loadConfig (/usr/local/lib/node_modules/jshint/src/cli.js:396:48)
at Object.exports.interpret (/usr/local/lib/node_modules/jshint/src/cli.js:511:21)
at Object. (/usr/local/lib/node_modules/jshint/bin/jshint:3:26)
at Module._compile (module.js:456:26)
reloading Packages/User/Fetch.sublime-settings
INFO:WebSocketClient:new client ('127.0.0.1', 39950)
INFO:WebSocketClient:Add to clients table <LiveReload.server.WebSocketClient.WebSocketClient object at 0x7f7d462f0990>
INFO:WebSocketClient:{'opcode': 1, 'payload': b'{"command":"hello","protocols":["http://livereload.com/protocols/official-6","http://livereload.com/protocols/official-7"],"ver":"2.0.8","ext":"Chrome","extver":"2.0.9"}', 'length': 169, 'hlen': 4, 'close_code': None, 'close_reason': None, 'fin': 1, 'mask': b'\xb0e\x9b\x8a', 'left': 0}
INFO:WebSocketClient:Command: hello
INFO:WebSocketClient:{'opcode': 1, 'payload': b'{"command":"info","plugins":{"socket":{"disable":false,"version":"1.0"},"less":{"disable":false,"version":"1.0"}},"url":"http://www.sublimetext.com/forum/viewtopic.php?f=5&t=2873&start=60"}', 'length': 189, 'hlen': 4, 'close_code': None, 'close_reason': None, 'fin': 1, 'mask': b'\xce\xf3[\x89', 'left': 0}
INFO:WebSocketClient:Command: info
b'{"command":"info","plugins":{"socket":{"disable":false,"version":"1.0"},"less":{"disable":false,"version":"1.0"}},"url":"http://www.sublimetext.com/forum/viewtopic.php?f=5&t=2873&start=60"}'
Writing file /home/alfa/.config/sublime-text-3/Packages/User/SublimeLinter.sublime-settings with encoding UTF-8 (atomic)
reloading Packages/User/SublimeLinter.sublime-settings
Writing file /home/alfa/.config/sublime-text-3/Packages/User/SublimeLinter.sublime-settings with encoding UTF-8 (atomic)
reloading Packages/User/SublimeLinter.sublime-settings
SublimeLinter: jshint: partwo.js ['/usr/local/bin/jshint', '--verbose', '--config', '/home/alfa/.jshintrc', '-']
SublimeLinter: jshint output:
shell.js: internal error
Error: EISDIR, illegal operation on a directory
at Object.fs.readSync (fs.js:476:19)
at Object.fs.readFileSync (fs.js:310:28)
at /usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:663:15
at Array.forEach (native)
at Object._cat (/usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:659:9)
at Object.cat (/usr/local/lib/node_modules/jshint/node_modules/shelljs/shell.js:1491:23)
at Object.exports.loadConfig (/usr/local/lib/node_modules/jshint/src/cli.js:396:48)
at Object.exports.interpret (/usr/local/lib/node_modules/jshint/src/cli.js:511:21)
at Object. (/usr/local/lib/node_modules/jshint/bin/jshint:3:26)
at Module._compile (module.js:456:26)

Plugin not found (in Package Control)

I tried to install it via Package Control, but it doesn't show up.
When I clone it to my packages, on ST3 load console shows this:

File "D:\Applications\Sublime Text 3 x64\Data\Packages\SublimeLinter-jshint\linter.py", line 14, in <module>
    from SublimeLinter.lint import Linter, util
ImportError: No module named 'SublimeLinter.lint'

vintage mode and jshint linter

Using the jshint linter with vintage mode exit_inster_mode bound to 'jj', the linter gets confused thinking there is an actual 'j' that remains in the editor when it is actually removed.

'jj' keybinding:

    // Vim 'jj'
    { "keys": ["j", "j"], "command": "exit_insert_mode",
        "context":
        [
            { "key": "setting.command_mode", "operand": false },
            { "key": "setting.is_widget", "operand": false }
        ]
    }

Is this a jshint plugin bug or a sublime linter bug?

It always lints code within <script> tag regardless of the type

I've got a page with handlebars templates within <script> tag:

<script type="text/x-handlebars">
  <h2>Welcome to Ember.js</h2>

  {{outlet}}
</script>

and Sublime Linter complains about syntax here. It should only try to parse code within <script> tag if there's type="text/javascript" or no type attribute specified at all (JS by default).

How do I set up global settings?

I want to be able to set global jshint settings like I was able to before the new architecture. Is that still possible, and if so, how?

Fixmyjs integration

Feature request.
Would be nice to integrate SublimeLinter-jshint with fixmyjs (https://github.com/jshint/fixmyjs/):
In Sublime Text "Find all errors" → first option on list "Fix all with fixmyjs" if its configured in SublimeLinte config.
Is it possible?

Linter throws an error in queue.py followed by a FileNotFoundError

This started a couple of weeks ago. Nothing changed in my environment, afaik.
System: OSX Yosemite, Node (0.10.34), JSHint 2.5.10 (installed at /opt/local/bin/, and in my path).
Sublime3, SublimeLinter-JSHint, trying to lint a simple JS file:

SublimeLinter: -------------------- 
SublimeLinter: error in SublimeLinter daemon: 
SublimeLinter: -------------------- 
SublimeLinter: Traceback (most recent call last):
  File "/Users/ttg/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/queue.py", line 58, in loop
    item = self.q.get(block=True, timeout=self.MIN_DELAY)
  File "./queue.py", line 175, in get
queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ttg/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/queue.py", line 66, in loop
    self.lint(view_id, timestamp)
  File "/Users/ttg/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/queue.py", line 112, in lint
    self.callback(view_id, timestamp)
  File "/Users/ttg/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/sublimelinter.py", line 123, in lint
    Linter.lint_view(view, filename, code, hit_time, callback)
  File "/Users/ttg/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 917, in lint_view
    linter.lint(hit_time)
  File "/Users/ttg/Library/Application Support/Sublime Text 3/Packages/SublimeLinter/lint/linter.py", line 1301, in lint
    cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

Here's my user settings file:

{
    "user": {
        "debug": false,
        "delay": 0.25,
        "error_color": "D02000",
        "gutter_theme": "Packages/SublimeLinter/gutter-themes/Danish Royalty/Danish Royalty.gutter-theme",
        "gutter_theme_excludes": [],
        "lint_mode": "background",
        "linters": {
            "jshint": {
                "@disable": false,
                "args": [],
                "excludes": []
            },
            "json": {
                "@disable": false,
                "args": [],
                "excludes": [],
                "strict": true
            }
        },
        "mark_style": "outline",
        "no_column_highlights_line": false,
        "passive_warnings": false,
        "paths": {
            "linux": [],
            "osx": [
                "/opt/local/bin"
            ],
            "windows": []
        },
        "python_paths": {
            "linux": [],
            "osx": [],
            "windows": []
        },
        "rc_search_limit": 3,
        "shell_timeout": 10,
        "show_errors_on_save": false,
        "show_marks_in_minimap": true,
        "syntax_map": {
            "html (django)": "html",
            "html (rails)": "html",
            "html 5": "html",
            "php": "html",
            "python django": "python"
        },
        "warning_color": "DDB700",
        "wrap_find": true
    }
}

Per-directory config files not working

I have a main .jshintrc in my project directory, and then another in a my testing subdirectory:

/
    .jshintrc
    somestuff/
    test/
        .jshintrc
        test.js

The linter isn't picking up the .jshintrc in the test/ directory, and is instead going with the .jshintrc in the top-level directory.

If I run jshint from the command line, everything checks out, so it's looking like a problem with SublimeLinter-jshint.

The config setting has a few problems

http://beta.prntscr.com/29ktgr
It did in fact open the correct file, as my rules were applied. Also, you can't specify "--config" in the "args" array, you have to do it like this: "config C:\Users\Jacob\Documents.jshintrc" (-> changelog is wrong). If you do it with "--" the error just says "Invalid config option" (or sth similar)

jshint_options usage

hi, is it possible to configure this plugin directly with jshint_options inside SublimeLinter configuration, without --config=/path/to/.jshintrc?

ISSUE: Still have "SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint'"

I checked all the docs and follow the steps I could do for a whole day, but I still can't use jshint to check my errors.
Here are the information on the debug mode. Could you give me any advise?

Thanks !

startup, version: 3065 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/Zarek/Library/Application Support/Sublime Text 3/Packages
state path: /Users/Zarek/Library/Application Support/Sublime Text 3/Local
hardware concurrency: 4
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/Zarek/Library/Application Support/Sublime Text 3/Installed Packages
found 4 files for base name Default.sublime-keymap
found 1 files for base name Default.sublime-mousemap
found 3 files for base name Main.sublime-menu
loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
wrote startup cache, added files: 1 orphaned files: 0 total files: 173 cache hits: 172
pre session restore time: 0.430286
using gamma: 2 (err: 6.9282)
first paint time: 0.48985
startup time: 0.50638
found 1 files for base name Default.sublime-theme
theme loaded
launching: /Applications/Sublime Text.app/Contents/MacOS/plugin_host
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_file_settings
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin Package Control.Package Control
reloading plugin SublimeLinter-jshint.linter
loaded 837 snippets
SublimeLinter: jshint linter loaded
reloading plugin SublimeLinter.commands
reloading plugin SublimeLinter.sublimelinter
plugins loaded
SublimeLinter: debug mode: on
SublimeLinter: temp directory: /var/folders/gh/r03bz0zj52v5v_z__47nz0th0000gn/T/SublimeLinter3
SublimeLinter: user shell: /bin/bash
SublimeLinter: computed PATH using /bin/bash:
/usr/local/bin/node
/usr/local/bin/npm
/usr/local/bin/jshint
/usr/local/lib/node_modules/jshint
/usr/local/lib/node_modules/jshint/bin/jshint
/usr/local/bin
/Library/Frameworks/Python.framework/Versions/3.4/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/opt/X11/bin
/usr/local/bin/jshint
/usr/local/lib/node_modules/jshint/bin/jshint
/usr/local/lib/node_modules/jshint

SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint'
SublimeLinter: found existing HTML syntax, version 3
SublimeLinter: found existing Rails syntax, version 1
found 3 files for base name Main.sublime-menu
Package Control: Skipping automatic upgrade, last run at 2014-09-29 22:44:08, next run at 2014-09-29 23:44:08 or after

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.