A line starting with (, [ or a template continues the expression above

tx0/ts:unexpected-multilinedefaultwarningbug

What it finds

``text const total = base (items || []).forEach(add) ``

A line that starts with (, [ or a template literal continues the expression on the line before when that line has no semicolon: the code above calls base with items || []. Automatic semicolon insertion does not apply there, so what reads as two statements is one.

A call, element access or tagged template is reported when its (, [ or template starts a new line, right after the end of the expression it applies to, and that line is indented no deeper than the line where the expression starts. A deeper indent shows that the continuation is meant, as in a chain of calls split over lines. Files with syntax errors are skipped.

From the rule's source, unexpected_multiline.rs.

Example from the rule's tests
function total(items: number[] | undefined, base: any) {  const sum = base  (items || []).forEach(add)tx0 reports: the expression on the line above is called by this line  const first = base  [0]tx0 reports: the expression on the line above is indexed by this line  const ok = base;  (items || []).forEach(add);  return [sum, first, ok];}function add(n: number) {  return n;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:unexpected-multiline" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:unexpected-multiline] reason="..."

tx0 explain tx0/ts:unexpected-multiline shows the same in the terminal. Found a false positive? Report it.