Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoThisBeforeSuperRule = rule.Rule{ Name: "no-this-before-super", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { return rule.RuleListeners{ ast.KindConstructor: func(node *ast.Node) { classNode := ast.GetContainingClass(node) if classNode == nil { return } extendsElem := ast.GetClassExtendsHeritageElement(classNode) if extendsElem == nil { return } exprWithType := extendsElem.AsExpressionWithTypeArguments() if exprWithType == nil || exprWithType.Expression == nil || exprWithType.Expression.Kind == ast.KindNullKeyword { return } body := node.Body() if body == nil || body.Kind != ast.KindBlock { return } for _, param := range node.Parameters() { if param == nil { continue } p := param.AsParameterDeclaration() if p != nil && p.Initializer != nil { checkViolations(p.Initializer, superNone, &ctx) } } checkStatements(body.Statements(), &ctx) }, } }, }
NoThisBeforeSuperRule disallows this/super before calling super() in constructors. https://eslint.org/docs/latest/rules/no-this-before-super
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.