ESLint is used to
yes | no | |
---|---|---|
compile JavaScript |
[ ] | [x] |
check style issues |
[x] | [ ] |
to detect unused variables |
[x] | [ ] |
measure code complexity |
[ ] | [x] |
to detect division by zero |
[x] | [ ] |
enforce coding conventions |
[x] | [ ] |
measure test coverage |
[ ] | [x] |
ESLint performs static analysis of source code. See ESLint.org
How do you install ESLint globally?
yes | no | |
---|---|---|
install eslint |
[ ] | [x] |
npm install eslint |
[ ] | [x] |
npm install eslint -g |
[x] | [ ] |
If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable:
npm install eslint -g
Which configuration options should be selected, if you want to set
- as errors: missing semicolon, empty block statements and use of constant expressions in conditions
- as warnings: whitespace at the end of line, mixed spaces and tabs for indentation (Smart Tabs off) and disallow labels that share a name with a variable
- other possible options off
yes | no | |
---|---|---|
"semi": 1, |
[ ] | [x] |
"semicolon": 2, |
[ ] | [x] |
"semi": 2, |
[x] | [ ] |
"no-empty": 2, |
[x] | [ ] |
"no-empty": 1 |
[ ] | [x] |
"no-empty-class": 1 |
[ ] | [x] |
"no-constant-condition": 1, |
[ ] | [x] |
"no-constant-condition": 2, |
[x] | [ ] |
"no-trailing-spaces": 1, |
[x] | [ ] |
"no-trailing-spaces": 2, |
[ ] | [x] |
"no-plusplus": 2, |
[ ] | [x] |
"no-plusplus": 1, |
[ ] | [x] |
"no-mixed-spaces-and-tabs": [1, false], |
[x] | [ ] |
"no-mixed-spaces-and-tabs": [1, true], |
[ ] | [x] |
"no-mixed-spaces-and-tabs": [2, false], |
[ ] | [x] |
"no-label-var": 1, |
[x] | [ ] |
"no-label-var": 2, |
[ ] | [x] |
Hey, let's be careful out there!