prefer-template
Configuration
rslint.config.ts
Rule Details
This rule is aimed to flag usage of + operators with strings. It encourages
the use of template literals instead of string concatenation.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
This rule does not report two string literals concatenated together (for
example, "Hello, " + "World!"), which is reported by the
no-useless-concat
rule instead.
The rule provides an autofix that rewrites the concatenation as a single
template literal, preserving comments around the + operators. Autofix is
skipped when any operand contains an octal or non-octal-decimal escape
sequence, because those cannot be represented in a template literal.