no-useless-concat
Disallow joining two string literals with + on the same line
"a" + "b" is a longer way to write "ab". Two literals next to each other are usually left over after someone removed a variable between them.
Both plain strings and template literals count. Strings on different lines are allowed, because that's a common way to break a long string.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"no-useless-concat" = "error" # or "warn"Examples#
example.js2 problems
const greeting = "Hello, " +Unexpected string concatenation of literals. "world";
const path = base + "/api" +Unexpected string concatenation of literals. `/users`;example.jsNo problems
const greeting = "Hello, world";
const path = base + "/api/users";
const label = "user " + id;
const message = "This sentence is too long for one line, " +
"so it goes on here.";