no-multi-str
Disallow strings that continue on the next line with a backslash
A backslash at the end of a line lets a quoted string continue on the next line. The line break is dropped, but the next line's indentation becomes part of the string. One space after the backslash is a syntax error that's hard to see.
Strings in JSX attributes can span lines without a backslash. They aren't reported.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"no-multi-str" = "error" # or "warn"Examples#
example.js1 problem
const help = "Usage: deploy <target> \Multiline support is limited to browsers supporting ES5 only.
--dry-run";example.jsNo problems
const help = "Usage: deploy <target> " +
"--dry-run";
const usage = `Usage: deploy <target>
--dry-run`;example.jsxNo problems
const banner = <Banner text="Deploys are paused
until Monday" />;