Code linting for JS, CoffeeScript & CSS with Sublime

Code linters are tools that analyze code and flag suspicious portions of it. It encourages proper usage of the language and can detect flaws that compilers can’t by enforcing best practices.

SublimeLinter brings linting to the Sublime Text code editor. It supports JS, CoffeeScript and CSS (among others).

Code Linting


Save yourself some trouble and install SublimeLinter via Sublime’s Package Control plugin.

Interestingly enough JS (and CSS) linting runs on JS and therefore needs a JS engine (Mac OS X comes with JavaScriptCore but you will be using node.js in 99% of the cases)


If you need to edit your setup you’ll do so on the user file: SublimeLinter.sublime-settings (Preferences->Package Settings->SublimeLinter->Settings - User). Here you can indicate, for instance, the path to node.js if it’s not found in its default location.

JS Linter

JS linting is built both via jslint and jshint and can be configured as follows:

"javascript_linter": "jshint",

If you don’t have an opinion on jsHint vs. jsLint, you are probably better off sticking to jsLint. And if you are curious you can read about their differences and (all the drama).

The main advantage of jsHint is that it is highly configurable (see details:

    "curly": true,
    "evil": true,
    "regexdash": true,
    "browser": true,
    "wsh": true,
    "trailing": true,
    "sub": true

CSS Linter:

Can be configured as well through csslint_options.

CoffeeScript Linter:

Will run without any special setup as long as the coffee package has been installed in your machine globally. If CoffeeScript is not installed in your machine, you can easily intall it running the following command (you should have Node Package Manager installed):

npm install -g coffee-script

How to use

If everything went ok while installing you should be all set once you restart Sublime. Offending lines will be highlighted and the status bar will give more details just by hovering those lines.

Sublime Text code hinting

Support Sublime.

July 26, 2012 ☼ codecode lintingsublime