Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JsxNoUndefRule = rule.Rule{ Name: "react/jsx-no-undef", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { check := func(element *ast.Node) { tagName := reactutil.GetJsxTagName(element) if tagName == nil { return } if tagName.Kind == ast.KindIdentifier { text := tagName.AsIdentifier().Text if text != "" && text[0] >= 'a' && text[0] <= 'z' { return } } identNode := reactutil.GetJsxTagBaseIdentifier(tagName) if identNode == nil { return } name := identNode.AsIdentifier().Text if name == "this" { return } if utils.IsShadowed(identNode, name) { return } ctx.ReportNode(identNode, rule.RuleMessage{ Id: "undefined", Description: "'" + name + "' is not defined.", }) } return rule.RuleListeners{ ast.KindJsxOpeningElement: check, ast.KindJsxSelfClosingElement: check, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.