ESLint with Visual Studio 2015

If you used Web Essentials as your linter, you probably learned by now that it doesn’t provide that functionality anymore in VS 2015.
One way to fix it is to start using tools like gulp… or you could install a plugin – Web Analyzer

The tool seems to rely on node, so you need to install that as well. Also, it doesn’t look like it installs all of the necessary packages (at least it didn’t work for me, until I installed the packages). So, you may need to run npm install for these packages:
npm install -g eslint eslint-config-defaults
npm install -g babel-eslint

To config it, go to Tools – Web Analyzer – Edit ESLint Settings. All of the configuration settings can be found at http://eslint.org/. For example, if you use Jasmine tests and jQuery, your “env” will look like this:
“env”: {
“browser”: true,
“node”: true,
“es6”: true,
“jasmine”: true,
“jquery”: true
}

In the “rules” block you can turn on/off individual rules and specify if they should show up as warnings (1) or errors (2).
“rules”: {
“eqeqeq”: 2,

This means that if ESLint sees “==” instead of “===” it will show up as an error in your Visual Studio Error List.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.