I recently read a couple of articles that convinced me to try ESLint:
We went ahead and implemented ESLint for the WebRTC samples repo, and we’re really pleased with the results. JSHint and JSCS are both brilliant tools, but ESLint provides more functionality than both of them combined. It’s quick, too: checking the 23 WebRTC samples main.js files in a couple of seconds, for 30 customised rules (along with the defaults).
If you want to do the same yourself, here’s a quick how-to for making the move from JSHint and JSCS to ESLint.
1. Create an eslint branch for your repo.
npm install grunt-eslint --save-dev to install ESLint and add it to your package.json file. Remove JSHint and JSCS from package.json.
3. Create an ESLint .eslintrc config file (or adapt ours). Add rules, globals and other settings based on your existing JSHint and JSCS config. Note that rules marked ‘recommended’ in the ESLint documentation are run by default.
4. Remove .jshintrc and .jscsrc files.
5. Replace JSHint and JSCS build tasks with ESLint — for example, in Gruntfile.js or gulpfile.js. Likewise for Git hooks and test scripts.
6. Install ESLint for your text editor and turn off JSHint and JSCS linting.
... // eslint-disable-line new-cap
Global declarations are the same:
/* global Fubar */
8. Run ESLint for your files and fix them as necessary. (This is much easier if you already have ESLint installed for your editor.) You can also run ESLint from the command line with the
--fix parameter to automatically fix some errors, such as spaces in arrays or function definitions.
9. Test all the files that you changed.
10. Make a pull request for the eslint branch, get an LGTM and merge it.