no-useless-concat
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-useless-concat": "error",
},
},
];Disallow unnecessary concatenation of literals or template literals
const a = `some` + `string`;
// these are the same as "10"
const b = '1' + '0';
const c = '1' + `0`;
const d = `1` + '0';
const e = `1` + `0`;// when a non string is included
const a = a + b;
const b = '1' + a;
const c = 1 + '1';
const d = 1 - 2;
// when the string concatenation is multiline
const e = "foo" +
"bar";Examples from the ESLint documentation.
no-useless-concat
eslint
export default [
{
rules: {
"no-useless-concat": "error",
},
},
];no-useless-concat
eslint plugin · suspicious
{
"rules": {
"no-useless-concat": "error"
}
}complexity/noUselessStringConcat
complexity · since 1.8.0
{
"linter": {
"rules": {
"complexity": {
"noUselessStringConcat": "error"
}
}
}
}Disallow useless concatenation of literals.
Disallow unnecessary concatenation of literals or template literals in <template>
Disallow function declarations that contain unsafe references inside loop statements
Enforce consistent brace style for all control statements
Disallow certain properties on certain objects