dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Logical operators in if statement

Open xseman opened this issue 1 year ago • 0 comments

Logical operators show coupling behavior when using && in a multi-line if statement. For instance:

if (
	true
	|| true && true
) {
	// ...
}

This behavior make sence, but when the line becomes too long, the && operator is indented under the || operator, which suggests a logical coupling:

if (
	true
	|| true
		&& true
) {
	// ...
}

Is there a way to maintain the coupling of lines while ignoring the maximum width? Alternatively, if a line must be forced onto a new line, can we configure the settings to disable this additional indentation?

if (
	true
	|| true
        && true
) {
	// ...
}

xseman avatar Nov 27 '24 07:11 xseman