Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ForbidComponentPropsRule = rule.Rule{ Name: "react/forbid-component-props", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { cfg := parseOptions(options) return rule.RuleListeners{ ast.KindJsxAttribute: func(node *ast.Node) { parent := reactutil.GetJsxParentElement(node) if parent == nil { return } tagName := reactutil.GetJsxTagName(parent) if tagName == nil { return } shape, ok := getTagShape(tagName) if !ok { return } if !shape.skipDomCheck && reactutil.IsCasedLowercaseFirstLetter(shape.componentName) { return } prop := reactutil.GetJsxPropName(node) if prop == "" { return } forbidden, opts := cfg.isForbidden(prop, shape.tag) if !forbidden { return } if opts != nil && opts.message != "" { ctx.ReportNode(node, rule.RuleMessage{ Description: opts.message, }) return } ctx.ReportNode(node, rule.RuleMessage{ Id: "propIsForbidden", Description: strings.ReplaceAll(msgPropIsForbidden, "{{prop}}", prop), Data: map[string]string{"prop": prop}, }) }, } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.