Skip to content

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

@pineapplemachine

Description

@pineapplemachine

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
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions