no-unexpected-multiline
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”const a = b (c || d).e();Configuration
Section titled “Configuration”js: lint: rules: no-unexpected-multiline: warn # off, warn (default), errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint | no-unexpected-multiline |
full |