June 2016
Beginner
248 pages
5h 18m
English
Although we don't need a compiler, we can still benefit from having the computer perform static analysis of our code. Linting tools are common in many languages for spotting common programming errors that may lead to subtle bugs or confusing code. You may be familiar with CodeRush, StyleCop, and others for .NET, or CheckStyle, Findbugs, Sonar, and others for Java.
We'll be using a JavaScript/ECMAScript linting tool called ESLint. Let's first install it globally:
> npm install -g eslint
Now create a config file to tell ESLint what rules to use as .eslintrc.json:
{ "extends": "eslint:recommended", "env": { "node": true, "es6": true, "mocha": true, "browser": true, "jquery": true }, "rules": { "semi": [2, "always"], "quotes": ...Read now
Unlock full access