How to install SublimeLinter and JSHint in Sublime Text

preview_player
Показать описание
In this short video you will learn how to add SublimeLinter and JSHint to the extremely popular Sublime Text editor.

BLOG POST:

Subscribe and Get More Great Tips!

Check me out around the web:
----------------------------------------­--------------------

----------------------------------------­--------------------

Description
----------------------------------------­--------------------

One of the tools essential for enforcing good JavaScript code habits is JSHint. JSHint is a forked version of JSLint originally created by Douglas Crockford. As Crockford once said at a Google Tech Talk that JSLint “will hurt your feelings”. Where JSHint varies from JSLint is that it is both community supported and allows for customizations and disabling features. It can be configured to be slightly less picky when evaluating your code.

Setting up JSHint in Sublime Text is simple but does require a few steps.

1. Installing Sublime Text Package Manager

2. Installing SublimeLinter 3

SublimeLinter is a plugin for Sublime Text that provides linters for various programming languages including Python, JavaScript, CSS, and Ruby. A linter is basically a plugin within your code editor that notifies you of stylistic or programming errors. If you read the documentation it states that “SublimeLinter itself is only a framework for linters. The linters are distributed as independent Sublime Text 3 plugins.”

To install this package in Sublime Text use the shortcut "Command+Shift+P" to open the “Command Palette” and type in "Package Control:Install Package". Next type in "SublimeLinter" and click to install.

3. Installing SublimeLinter-Jshint

Now that the framework is installed you will need to install the specific linter you are interested in. In this example we will be using JSHint. Again open the Command Palette and install the package "SublimeLinter-jshint".

4. Installing Node.Js And SublimeLinter-Jshint

Once that is done your last step is to fire up your trusty terminal and enter:

npm install -g jshint
// sudo npm install -g jshint (if you have permission issues)

That’s it! You are now free to be harassed by your linter of choice.
Рекомендации по теме
Комментарии
Автор

Very helpful, this video solved my difficulty getting JSHint installed fast, thanks for posting!

KokkoTso
Автор

Made the process of adding this valuable feature very easy...thanks.

dougwarner
Автор

Thank you for a short and clear video.

tol-shi
Автор

Thank you for the video which is filmed professionally.

tuncaylaogren
Автор

For those who has troubles setting up Linter and JSHint on native linux client(maybe there's someone as stupid as me :D)
My problem was bad Node.js in standart repository. Just download it from official site, exactly like in this video! P.S. Joel, thank you for such short and simple guide, and sorry for my english

twlvz
Автор

Thank you for the clear explanation. Works superbly.

Code_Whisker
Автор

Joel - thanks so much for this. Works like a charm!

MarkKeckeis
Автор

In this short video you will learn how to add SublimeLinter and JSHint to the extremely popular Sublime Text editor.

joellongie
Автор

This was very useful, thanks for putting this clip out there :)

alirezaaghamohammadi
Автор

If you use tabs as your indentation and the wrong sections of code are highlighted, create a .jshintrc file in your root directory containing { "indent": 1 }, clear the linter caches, restart Sublime and voila!

LeoTM
Автор

Just in case others were wondering - I just realized you said Shift+Ctrl+P then corrected it by saying it's actually command, but on my windows computer when typing Shift+Ctrl+P it worked, when trying Shift+Alt(cmd)+P it pulled up the project menu

rachelconatser
Автор

Didn't work until I added the path to jshint in settings: From menu go to Preferences > Package Settings > SublimeLinter > Settings

"paths": {
"linux": [ "/usr/local/node_modules/jshint/bin/"],
"osx": [],
"windows": []
},

jerrysha
Автор

Took me an hour to figure it out. I did everything but it didn't work. I had to go into the setting and type "debug":True; then restart sublime to get it working. I'm on windows

Автор

thanks for the help! I tried to install eslint in sublime by myself and got lost because it involved adding things to the path.

GabrielMeyr
Автор

couldn't get sj node to install, too much of a hassle with all the terminal crap. I'll just try ShiftEdit

denverarsenal
Автор

If you followed the steps exactly, and the linter is still not working, try this:

1. Open the Command Pallette
2. Start typing: Sublime Linter
3. Look for "Sublime Linter: Enable Linter"

And also try:

1. Open the Command Pallette
2. Start typing: Sublime Linter
3. Look for "Sublime Linter: Choose Lint Mode"
4. Click the "Background" option

If that still doesn't work, check the troubleshooting guide for SublimeLinter here:

gabrien-symons
Автор

Note that SublimeLinter-jshint is only available for ST3.

ownage
Автор

Very helpful. Thanks a lot for this job. What is your advice between jslint and jshint ?

ensjlxu
Автор

it does not work to me. When i put a semicolon out, it does not show any errors

tungng
Автор

Awesome. If I have this installed is there still a reason to use gulp-jshint or gulp-jslint?

mattmorisette
visit shbcf.ru