Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoIsMountedRule = rule.Rule{ Name: "react/no-is-mounted", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { return rule.RuleListeners{ ast.KindCallExpression: func(node *ast.Node) { call := node.AsCallExpression() callee := ast.SkipParentheses(call.Expression) if callee.Kind != ast.KindPropertyAccessExpression { return } prop := callee.AsPropertyAccessExpression() if ast.SkipParentheses(prop.Expression).Kind != ast.KindThisKeyword { return } nameNode := prop.Name() if nameNode == nil { return } switch nameNode.Kind { case ast.KindIdentifier: if nameNode.AsIdentifier().Text != "isMounted" { return } case ast.KindPrivateIdentifier: if nameNode.AsPrivateIdentifier().Text != "#isMounted" { return } default: return } if ast.FindAncestor(node.Parent, isPropertyOrMethodDefinition) == nil { return } ctx.ReportNode(callee, rule.RuleMessage{ Id: "noIsMounted", Description: "Do not use isMounted", }) }, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.