Skip to content

Unexpected formatting with preferSingleLine and memberExpression.linePerExpression #738

@azais-corentin

Description

@azais-corentin

Describe the bug

dprint-plugin-typescript version: 0.95.11

I get unexpected formatting with both preferSingleLine and memberExpression.linePerExpression set to true.

Reproduction here

Configuration

{
    "preferSingleLine": true,
    "memberExpression.linePerExpression": true
}

Input Code

{
    screen.setColors({
        text: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`,
        progress: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`,
        background: `#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`,
    })
}

Expected Output

{
  screen.setColors({
    text: `#${
      Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
    }`,
    progress: `#${
      Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
    }`,
    background: `#${
      Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
    }`,
  });
}

Actual Output

{
  screen.setColors({
    text: `#${
      Math
        .floor(Math.random() * 16777215)
        .toString(16)
        .padStart(6, "0")
    }`,
    progress: `#${
      Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
    }`,
    background: `#${
      Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
    }`,
  });
}

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