no_template_curly_in_string

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoTemplateCurlyInString = rule.Rule{
	Name: "no-template-curly-in-string",
	Run: func(ctx rule.RuleContext, options any) rule.RuleListeners {
		regex := regexp.MustCompile(`\$\{[^}]+\}`)
		return rule.RuleListeners{
			ast.KindStringLiteral: func(node *ast.Node) {
				expr := node.AsStringLiteral()
				if regex.MatchString(expr.Text) {
					ctx.ReportNode(node, rule.RuleMessage{
						Id:          "unexpectedTemplateExpression",
						Description: "Template literal placeholder syntax in regular strings is not allowed.",
					})
				}
			},
		}
	},
}

https://eslint.org/docs/latest/rules/no-template-curly-in-string

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