forward_ref_uses_ref

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ForwardRefUsesRefRule = rule.Rule{
	Name: "react/forward-ref-uses-ref",
	Run: func(ctx rule.RuleContext, options []any) rule.RuleListeners {
		checkFunction := func(node *ast.Node) {
			call := parentForwardRefCall(node)
			if call == nil {
				return
			}
			params := reactutil.FunctionParameters(node)
			if len(params) != 1 {
				return
			}
			param := params[0]
			ctx.ReportNodeWithSuggestions(
				node,
				missingRefParameterMessage(),
				addRefParameterSuggestion(ctx, node, param),
				removeForwardRefSuggestion(ctx, call, node),
			)
		}

		return rule.RuleListeners{
			ast.KindArrowFunction:      checkFunction,
			ast.KindFunctionExpression: checkFunction,
		}
	},
}

https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forward-ref-uses-ref.md

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL