- Improved code quality
- Less errors in your code
- Less time debugging
Most modern code editors support linting in some form or another. For the purposes of this article I’ll show you how to quickly get setup in Sublime Text 3 using JSHint. The steps for ESLint are relatively the same.
- First make sure you have the Sublime Text package manager installed.
- Then make sure you have Node installed.
- While in Sublime Text you can press
Shift+Command Pto bring up your command palette.
- Then type install and press enter.
- Type in
sublime-linterand hit enter. This will install the sublime linter package.
- Bring up the command palette again and type in
jshintThere should be a package called
sublimelinter-jshint, hit enter to install it.
- Open up your favorite terminal and type in
npm install -g jshint
If you have another linter you prefer such as
eslint feel free to install the packages for that.
You can place this snippet in the root of your project and name it
.jshintrc to apply your own custom rules. Or you can modify your global jshint configuration in sublime text.