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.

  1. Using package control, navigate to install package, locate SublimeLinter and install it.
  2. 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)
  3. Back in package control, navigate to install package, locate SublimeLinter-contrib-eslint and install it.

Now as you edit your javascript files (inside this configured project) you will get some hints around how to make your code better.  I especially love this as it forces me to use the latest and greatest javascript features that are available.  It will also force you to write clean readable and maintainable code.

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.

Standard: https://standardjs.com/#install

AirBnb: https://www.npmjs.com/package/eslint-config-airbnb

And many more!

X