eslint/no-useless-concat Suspicious β
What it does β
Disallow unnecessary concatenation of literals or template literals
Why is this bad? β
Itβs unnecessary to concatenate two strings together when they could be combined into a single literal.
Examples β
Examples of incorrect code for this rule:
javascript
var foo = "a" + "b";
javascript
var foo = "a" + "b" + "c";
Examples of correct code for this rule:
javascript
var foo = "a" + bar;
// when the string concatenation is multiline
javascript
var foo = "a" + "b" + "c";
How to use β
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny no-useless-concat
json
{
"rules": {
"no-useless-concat": "error"
}
}