SublimeText is awesome! However, the most awesome part of it is that you can always make it better through it’s extensive plugin ecosystem. Let’s take a look at how we can quickly make SublimeText better by adding SublimeLinter and eslint into the mix.
To do this there are three steps that we need to take.
- Using package control, navigate to install package, locate SublimeLinter and install it.
- In the command line perform the following steps
a. navigate to the folder that houses your project
b. type npm init (accept all defaults) – this will generate a package.json for your project (event if it isn’t a node project!!!)
c. type npm install eslint -g (to install it for command line use on your machine)
d. type npm install eslint –save-dev (to make it available inside your project)
d. type eslint –init (and answer the questions as they make sense for your project)
- Back in package control, navigate to install package, locate SublimeLinter-contrib-eslint and install it.
As you bump against different rule violations (like tabs vs spaces) you can configure your project in the .eslintrc file. Just do a quick google search for eslint and the rule name to read all about it.
There are several different types of rules that you can follow.
And many more!