Skip to content

no-unexpected-multiline

Reports a line that begins with (, [ or a template literal right after a line that ends an expression, where the two lines are one expression: var d = a followed by (b); calls a(b). A line that begins with /, + or another operator is not reported.

Automatic semicolon insertion does not insert a semicolon before (, [ or a template, so the new line continues the expression above: a followed by (b) is a call and followed by [b] is a property access, and the program runs with a different meaning than the layout shows.

To fix, end the statement with a semicolon, or join the lines on purpose.

Reported
const a = b
(c || d).e();
js:
lint:
rules:
no-unexpected-multiline: warn # off, warn (default), error

Enabled by the presets: js/eslint-recommended.

Suppress one line with sudsy-disable-next-line no-unexpected-multiline in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint no-unexpected-multiline full