Class should inherit from a constructor
- INHERIT_NON_CONSTRUCTOR
- Error
- High
- es6
This rule applies when a class inherits from a non-constructor.
When a class inherits from non-constructor values like the following, a TypeError
exception occurs:
- Arrow function
- Async function
- Generator function
- Non-function values except
null
Noncompliant Code Example
View with compliant examples side by sidelet Foo = () => { };
class Bar extends Foo { } // INHERIT_NON_CONSTRUCTOR alarm because an arrow function is not a constructor.
Compliant Code Example
View with noncompliant examples side by sidelet Foo = function () { };
class Bar extends Foo { }
Version
This rule was introduced in DeepScan 1.32.0.