2 title: constructor-super
7 Constructors of derived classes must call `super()`.
8 Constructors of non derived classes must not call `super()`.
9 If this is not observed, the JavaScript engine will raise a runtime error.
11 This rule checks whether or not there is a valid `super()` call.
15 This rule is aimed to flag invalid/missing `super()` calls.
17 Examples of **incorrect** code for this rule:
22 /*eslint constructor-super: "error"*/
27 super(); // This is a SyntaxError.
32 constructor() { } // Would throw a ReferenceError.
35 // Classes which inherits from a non constructor are always problems.
36 class A extends null {
38 super(); // Would throw a TypeError.
42 class A extends null {
43 constructor() { } // Would throw a ReferenceError.
49 Examples of **correct** code for this rule:
54 /*eslint constructor-super: "error"*/
72 If you don't want to be notified about invalid/missing `super()` callings in constructors, you can safely disable this rule.