Skip to content

multilineAmbiguities

Reports ambiguous multiline expressions that could be misinterpreted.

✅ This rule is included in the ts stylistic and stylisticStrict presets.

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
const value: string
value
=
const identifier: (arg: string) => string
identifier
(
const expression: string
expression
)
const doSomething: () => void
doSomething
();
const
const data: string
data
=
const getArray: {
value: string;
}[]
getArray
[0].
value: string
value
;
const
const result: string
result
=
const calculate: (strings: TemplateStringsArray) => string
calculate
`template literal`;
function
function process(): void
process
() {
const
const a: void
a
=
const b: (arg: {
execute(): void;
}) => {
execute(): void;
}
b
(
const c: {
execute(): void;
} | undefined
c
||
const d: {
execute(): void;
}
d
).
function execute(): void
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 ❤️‍🔥 around the world by the Flint team and contributors.