I know this is very basic question, but it's very strange that I cannot make it work, after spending hours, I really need help.
Actually, I clean-installed sublime Text 2 just for this; just Sublime Package Control has been installed.
Firstly, I prepared a foo.js code:
function x(a, b)
{
return a + b
res = x(10, 20)
console.log("res = " + res);
which result:
$ jshint foo.js
foo.js: line 3, col 17, Missing semicolon.
foo.js: line 6, col 16, Missing semicolon.
foo.js: line 2, col 1, Unmatched '{'.
3 errors
So, jshint works as expected so far for the simple test.
I tried many things to get it work with Sublime Linter, but with no success, I clean-installed the sublime app, then followed a tutorial video:
https://tutsplus.com/lesson/sublime-linter/
Looks easy, and Sublime Linter appearrently successfully installed and readme appears as the video show at 00:30, but in my case, after that, saving or whatever never triggers anything.
Well, I'm totally lost. Please advise. Thanks.
UPDATE:
I noticed sublimeText console shown a error!
Traceback (most recent call last):
File "./SublimeLinter.py", line 431, in _update_view
File "./SublimeLinter.py", line 143, in run_once
File "./sublimelinter/modules/base_linter.py", line 291, in run
File "./sublimelinter/modules/javascript.py", line 72, in parse_errors
ValueError: Error from jshint: /Users/ken/Library/Application Support/Sublime Text 2/Packages/SublimeLinter/sublimelinter/modules/libs/jshint/jshint.js:7881
})(window)
^
ReferenceError: window is not defined
at Object.require.util (/Users/ken/Library/Application Support/Sublime Text 2/Packages/SublimeLinter/sublimelinter/modules/libs/jshint/jshint.js:7881:4)
EDIT: ok, this seems bug, I should have checked there first..
There is currently a workaround for this:
The hotfix for this is - in Linux installations - to add
global.window = {};
to the top of the file
~/.config/sublime-text-2/Packages/SublimeLinter/sublimelinter/modules/libs/jshint/jshint.js
For Windows or OS/X installations you need to find the location of your Sublime Text package configurations.