Skip to content

Commit c653cc0

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
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: #5210 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Johan Bergström <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent 9dbd66f commit c653cc0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ rules:
6767
# http://eslint.org/docs/rules/#ecmascript-6
6868
arrow-parens: [2, "always"]
6969
arrow-spacing: [2, {"before": true, "after": true}]
70+
constructor-super: 2
7071
no-arrow-condition: 2
72+
no-class-assign: 2
73+
no-const-assign: 2
74+
no-dupe-class-members: 2
75+
no-this-before-super: 2
7176
prefer-const: 2
7277

7378
# Strict Mode

0 commit comments

Comments
 (0)