diff options
author | Rich Trott <rtrott@gmail.com> | 2016-02-10 15:05:36 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-02-12 13:34:38 -0800 |
commit | ffbc05af5925191bf6377a2ce43ede5f475f2f07 (patch) | |
tree | 2dbfc532339d1110ca77c1272945be31aa999e98 /.eslintrc | |
parent | ab6fe5998a625af68b58ccc63b230ef37c054af7 (diff) | |
download | node-new-ffbc05af5925191bf6377a2ce43ede5f475f2f07.tar.gz |
tools: add recommended linting rules
This change adds ESLint rules that meet two criteria:
* recommended by ESLint
* require no code changes
These rules are:
* `no-func-assign`: Disallow overwriting a function that was written
as a function declaration.
* `no-negated-in-lhs`: Disallow negated left operand of `in` operator.
It prevents `if(!a in b)` when `if(!(a in b))` is intended.
* `no-obj-calls`: Disallow global object function calls. It prevents
errors like `JSON()` and `Math()`.
to exercise the code in tests or whatever, it can sneak in.
* `use-isnan`: Prevents errors like `if (foo == NaN)`
* `no-octal`: Disallows confusing constructs like `var num = 071;`
* `no-delete-var`: Delete works on properties, not variables. Disallows
`delete foo`.
PR-URL: https://github.com/nodejs/node/pull/5188
Reviewed-By: targos - Michaƫl Zasso <mic.besace@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to '.eslintrc')
-rw-r--r-- | .eslintrc | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -26,16 +26,21 @@ rules: no-ex-assign: 2 no-extra-boolean-cast : 2 no-extra-semi: 2 + no-func-assign: 2 no-invalid-regexp: 2 no-irregular-whitespace: 2 + no-negated-in-lhs: 2 + no-obj-calls: 2 no-proto: 2 no-unexpected-multiline: 2 no-unreachable: 2 + use-isnan: 2 valid-typeof: 2 # Best Practices # https://github.com/eslint/eslint/tree/master/docs/rules#best-practices no-fallthrough: 2 + no-octal: 2 no-redeclare: 2 # Stylistic Issues @@ -71,6 +76,7 @@ rules: # Variables # https://github.com/eslint/eslint/tree/master/docs/rules#variables + no-delete-var: 2 no-undef: 2 no-unused-vars: [2, {"args": "none"}] |