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

Multi-line binary expression with a comparison operator is formatted differently than other binary expressions, without explanation or any apparent configuraton option

Open pineapplemachine opened this issue 3 months ago • 0 comments

Describe the bug

dprint-plugin-typescript version: 0.93.2 & latest compiled from main branch

I want the operands of a binary operator expression spread across multiple lines to always have the same indentation level. For some reason, comparison operators seem to be an exception for this, and the second operand is indented at a greater level than the first operand. I would prefer to enforce comparison operators the same as all other binary operators, and I didn't find anything in the docs that would explain this difference or how to fix it.

Input Code

function mousePanExceedsStickyThreshold(): boolean {
    return (
        Math.abs(panAccumulatedDelta.value) >
        panAccumulatedDeltaThreshold.value
    );
}

Expected Output

function mousePanExceedsStickyThreshold(): boolean {
    return (
        Math.abs(panAccumulatedDelta.value) >
        panAccumulatedDeltaThreshold.value
    );
}

Actual Output

function mousePanExceedsStickyThreshold(): boolean {
    return (
        Math.abs(panAccumulatedDelta.value) >
            panAccumulatedDeltaThreshold.value
    );
}

pineapplemachine avatar Oct 31 '25 16:10 pineapplemachine