diff options
author | Rich Trott <rtrott@gmail.com> | 2016-02-12 16:59:05 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-02-15 22:14:30 -0800 |
commit | 57891c3cfe1944440957afaca4736a22d241349a (patch) | |
tree | 9b709adbac568da68d06e784b829ec3662c03119 /.eslintrc | |
parent | 9ab19afe0b5d6298a4cc17f490d0d13523ecef9c (diff) | |
download | node-new-57891c3cfe1944440957afaca4736a22d241349a.tar.gz |
tools: add recommended ES6 lint rules
Add the following (seemingly non-controversial) ESLint rules:
* `constructor-super`: Verify calls of `super()` in constructors. Flags
situations that will result in runtime errors. Since we do not have 100%
code coverage in tests, linting for runtime errors is useful.
* `no-class-assign`: Flags cases where a class declaration is
overwritten via variable assignment later. It is difficult to think of a
situation where this is not an error, and easy to think of situations
(particularly in lengthy test files) where it could come up.
* `no-const-assign`: Assigning to a const after declaration is a runtime
error.
* `no-dupe-class-members`: Declare a class member twice, then only the
second one counts. This is analogous to redeclaring a variable.
* `no-this-before-super`: Using `this` or `super` in a derived class
before a call to `super()` is a `ReferenceError`
PR-URL: https://github.com/nodejs/node/pull/5210
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rod Vagg <rod@vagg.org>
Diffstat (limited to '.eslintrc')
-rw-r--r-- | .eslintrc | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -67,7 +67,12 @@ rules: # http://eslint.org/docs/rules/#ecmascript-6 arrow-parens: [2, "always"] arrow-spacing: [2, {"before": true, "after": true}] + constructor-super: 2 no-arrow-condition: 2 + no-class-assign: 2 + no-const-assign: 2 + no-dupe-class-members: 2 + no-this-before-super: 2 prefer-const: 2 # Strict Mode |