Install ESLint Through NPM

Install ESLint globally by running npm install -g eslint

Create a .eslint File in Your User Directory

We'll create a global .eslint.json file which will dictate linting for all directories below the User directory — for example Users/username/Projects. Linting settings can be overridden on a per-project basis by adding a .eslintrc file to a specific project directory.

  1. Open the terminal
  2. Go to the User directory by running cd
  3. To install linting rules from a style guide, you'll need a package.json file. Create one by running npm init and following the prompts
  4. Generate an .eslintrc file by running eslint --init. I selected the 'Use a popular style guide' option, followed by 'Airbnb', and finally 'JSON'

Install Sublime Packages

  1. Open Sublime Text
  2. Install Package Control if you don't have it
  3. Install SublimeLinter and SublimeLinter ESLint with Package Control
  4. Restart Sublime Text
  5. Edit a JavaScript file that resides under the User directory

At this point linting should be enabled and you should see warnings appear at the bottom of your editor!

Noticed an error in these steps or have feedback? You can reach out to me using the contact form.

Back to Blog