Skip to content

noMultiStr

biome.json
{
"linter": {
"rules": {
"nursery": {
"noMultiStr": "error"
}
}
}
}

Disallow creating multiline strings by escaping newlines.

Escaping newlines to create multiline strings is discouraged because it can lead to subtle errors caused by unexpected whitespace after the backslash.

const foo =
"Line 1\n\
Line 2";
code-block.js:2:5 lint/nursery/noMultiStr ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Escaping newlines to create multiline strings is disallowed.

1 │ const foo =
> 2 │ “Line 1\n\
^^^^^^^^^^
> 3 │ Line 2”;
^^^^^^^
4 │

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

const foo = "Line 1\nLine 2";
const bar = `Line 1
Line 2`;