Skip to content

multilineAmbiguities

Reports ambiguous multiline expressions that could be misinterpreted.

✅ This rule is included in the ts stylistic preset.

When a line ends with an expression and the next line starts with certain characters (parentheses, brackets, or template literals), JavaScript may interpret them as a continuation of the previous line rather than separate statements. This can lead to unexpected behavior and runtime errors that are difficult to debug.

const value = identifier(expression)
doSomething();
const data = getArray
[0].value;
const result = calculate
`template literal`;
function process() {
const a = b
(c || d).execute();
}

This rule is not configurable.

If you consistently use semicolons and have tooling that enforces their presence, this rule may be unnecessary. However, having this rule enabled provides an additional safety net against accidental multiline ambiguities.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.