This rule is the same as the standard ESlint constructor-super
rule, but it additionally recognizes the class decorators in Twist that change a class to be inherited from a base class (e.g. @Store
, @Component
). It reads this configuration from the .twistrc
file, so only decorators that actually extend the class are required to have a super()
call in the constructor.
The following patterns are not considered errors:
@Store
class MyStore {
constructor(INITIAL_STATE) {
super(INITIAL_STATE);
}
}
@Prototype({x : 2})
class MyClass {
constructor() {
}
}
The following patterns are considered errors:
@Store
class MyStore {
constructor() {
}
}
@Prototype({x : 2})
class MyClass {
constructor() {
super();
}
}
If you are not using the decorators of Twist.