jsx_no_literals

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

cspell:ignore mdash

Index

Constants

This section is empty.

Variables

View Source
var JsxNoLiteralsRule = rule.Rule{
	Name: "react/jsx-no-literals",
	Run: func(ctx rule.RuleContext, options any) rule.RuleListeners {
		cfg := parseConfig(options)
		var renamedImports map[string]string
		if cfg.hasElementOverrides() {
			renamedImports = collectRenamedImports(ctx.SourceFile)
		} else {
			renamedImports = map[string]string{}
		}

		return rule.RuleListeners{
			ast.KindStringLiteral: func(node *ast.Node) {
				handleStringLiteral(ctx, node, &cfg, renamedImports)
			},
			ast.KindJsxText: func(node *ast.Node) {
				handleJsxText(ctx, node, &cfg, renamedImports)
			},
			ast.KindNoSubstitutionTemplateLiteral: func(node *ast.Node) {
				handleTemplate(ctx, node, &cfg, renamedImports)
			},
			ast.KindTemplateExpression: func(node *ast.Node) {
				handleTemplate(ctx, node, &cfg, renamedImports)
			},
			ast.KindJsxAttribute: func(node *ast.Node) {
				handleJsxAttribute(ctx, node, &cfg, renamedImports)
			},
		}
	},
}

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