pi-lens
Version:
Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo
26 lines (24 loc) • 864 B
YAML
# DISABLED (#206): needs `inside` + `not has` relational matching the runner's
# rule interpreter can't execute; also redundant with tsc TS2377 ("Constructors
# for derived classes must contain a 'super' call").
id: constructor-super
message: super() must be called in derived class constructors.
severity: error
language: TypeScript
rule:
pattern:
selector: method_definition
context: class A { constructor($$$) { $$$ }}
inside:
stopBy: end
pattern: class $CLASS extends $BASE { $$$ }
not:
has:
stopBy:
any:
- kind: class_declaration
- kind: class
- kind: arrow_function
pattern: super($$$)
note: |
Constructors of derived classes must call super(). Constructors of non derived classes must not call super(). If this is not observed, the JavaScript engine will raise a runtime error.