Desired Behaviour
Linting of .js files with Sublime Text 3.
Actual Behaviour
No linting is taking place.
For example the following shows no errors:
var x = ""
Steps To Reproduce
Environment
Tools > SublimeLinter > Lint Mode > "Background"
Tools > SublimeLinter > Mark Style > "Fill"
In Sublime Text (to install SublimeLinter and JSHint plugin)
At Command Line
Install node.js, npm and jshint with:
sudo apt-get install nodejs npm
sudo npm install -g jshint
Quit and restart Sublime Text.
Troubleshooting
At Command Line:
hash -r
which jshint
returns
/usr/local/bin/jshint
I also tried this solution (https://stackoverflow.com/a/21203179/1063287) involving manuualy changing the path in Preferences > Package Settings > SublimeLinter > "Settings - User"
and restarted Sublime Text but there was no change:
"paths": {
"linux": ["/usr/local/bin/jshint"],
"osx": [],
"windows": []
},
Documentation Reference
On how to install jshint plugin:
https://github.com/SublimeLinter/SublimeLinter-jshint
UPDATE
I just ran this in command line - the results may help to troubleshoot:
jshint --version
/usr/bin/env: node: No such file or directory
This also comes up in Sublime Text Console:
SublimeLinter: WARNING: no jshint version could be extracted from:
/usr/bin/env: node: No such file or directory
This seems to make JSHint work - but if anyone could confirm that this is the best approach that would be great:
https://github.com/joyent/node/issues/3911#issuecomment-8956154
I've found this is often a misnaming error, if you install from a package manager you bin may be called nodejs so you just need to symlink it like so "ln -s /usr/bin/nodejs /usr/bin/node"
Note: Using this solution, no adjustments need to be made to paths in Preferences > Package Settings > SublimeLinter > "Settings - User"
.