Constructor of inherited class should call super
- MISSING_SUPER_CALL
- Error
- High
- es6
This rule applies when constructor of inherited class does not have super
call.
When instantiating the class of such a case, a ReferenceError
exception is thrown.
Note: This case could not be a problem if a certain transpiler is used, but it can be good to fix the problem for using native class without the transpiler.
Noncompliant Code Example
View with compliant examples side by sideclass A {}
class B extends A {
constructor() { // MISSING_SUPER_CALL alarm
this.prop = 42;
}
}
var obj = new B();
Compliant Code Example
View with noncompliant examples side by sideclass A {}
class B extends A {
constructor() {
super();
this.prop = 42;
}
}
var obj = new B();
Version
This rule was introduced in DeepScan 1.0.0-alpha.