Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var JsxNoCommentTextnodesRule = rule.Rule{ Name: "react/jsx-no-comment-textnodes", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { return rule.RuleListeners{ ast.KindJsxText: func(node *ast.Node) { parent := node.Parent if parent == nil || (!ast.IsJsxElement(parent) && !ast.IsJsxFragment(parent)) { return } jsxText := node.AsJsxText() if jsxText == nil || jsxText.ContainsOnlyTriviaWhiteSpaces { return } source := ctx.SourceFile.Text() startPos, endPos := node.Pos(), node.End() if startPos < 0 || endPos > len(source) || startPos >= endPos { return } raw := source[startPos:endPos] if !hasCommentLikeLine(raw) { return } ctx.ReportRange(core.NewTextRange(startPos, endPos), rule.RuleMessage{ Id: "putCommentInBraces", Description: "Comments inside children section of tag should be placed inside braces", }) }, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.