Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JsxMaxDepthRule = rule.Rule{ Name: "react/jsx-max-depth", Run: func(ctx rule.RuleContext, rawOptions any) rule.RuleListeners { opts := parseOptions(rawOptions) handleJSX := func(node *ast.Node) { if !isLeaf(node) { return } d := getDepth(node) if d > opts.max { report(ctx, node, d, opts.max) } } return rule.RuleListeners{ ast.KindJsxElement: handleJSX, ast.KindJsxSelfClosingElement: handleJSX, ast.KindJsxFragment: handleJSX, ast.KindJsxExpression: func(node *ast.Node) { expr := jsxExpressionInner(node) if expr == nil { return } expr = ast.SkipParentheses(expr) if expr == nil || expr.Kind != ast.KindIdentifier { return } element := findJsxElementOrFragment(expr, ctx.TypeChecker, map[string]bool{}, 0) if element == nil { return } baseDepth := getDepth(node) checkDescendant(ctx, baseDepth, opts.max, reactutil.GetJsxChildren(element)) }, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.