noMultiStr
Summary
Section titled “Summary”- Rule available since:
v2.3.8 - Diagnostic Category:
lint/nursery/noMultiStr - This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
- Same as
no-multi-str
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noMultiStr": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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 1Line 2`;Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.