Constructor of inherited class should call super

  • MISSING_SUPER_CALL
  • Error
  • High
  • No tags

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 side
class A {}
class B extends A {
    constructor() { // MISSING_SUPER_CALL alarm
        var a = 1;
    }
}

new B();

Compliant Code Example

View with noncompliant examples side by side
class A {}
class B extends A {
    constructor() {
        super();
        var a = 1;
    }
}

Version

This rule was introduced in DeepScan 1.0.0-alpha.