跳转到内容

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 │

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