Instead of relying on your project's linting tasks (grunt lint
or npm run lint
), wouldn't it be better to have Atom proactively linting your JS as you compose it, using Mobify's code style as a ruleset? Here's how!
- Install Node.js and NPM with NVM
- Install eslint and Mobify's code style globally:
npm install -g eslint
npm install -g mobify-code-style
- Install the linter package
- Install the linter-eslint package
- Open your Atom package settings for
linter-eslint
and ensure:- Your
ESLint Path
is set- Find your ESLint path by running
which eslint
in a terminal
- Find your ESLint path by running
- Your
.eslintrc Path
is set to the ES5 config file from Mobify's code style- This config is the fallback for when an existing ESLint config does not exist in the current project
- Your
Global Node Installation Path
is set- Find this by running
npm get prefix
in a terminal
- Find this by running
- Your
Your Atom settings will look something like this:
Now restart Atom and open a JS file to see it in action.
Tip: When working on a project that does not need to conform to this code style,
toggle the linter off/on by opening the command palette with shift+⌘+p (Mac) or shift+ctrl+p (PC) and type + select Linter: Toggle