Skip to content

Sequence expressions not formatted "correctly" #427

Open
@CharlieEriksen

Description

@CharlieEriksen

Version used

v3.0.2

Describe the bug

The pretty formatter handles a sequence expressions in a way that makes it hard to read. I tried looking at how this is handled, but I've gotta admit that the printing logic is a bit of voodoo for me.

To Reproduce

Consider this code:

Object.defineProperty(e, "__esModule", { value: !0 }),
  (e.STORE_NAME_KEY_VALUE = "keyValue"),
  (e.STORE_NAME_MESSAGE_LOG = "messages"),
  (e.STORE_NAME_MAIN_LOG = "log"),
  (e.STORE_NAME_INBOX_MESSAGES = "inboxMessages"),
  (e.KEY_PATH_BASE_INCREMENT = "id");

When parsed and pretty-formatted with the default options, it returns this instead:

    Object.defineProperty(e, "__esModule", { value: !0 }), e.STORE_NAME_KEY_VALUE = "keyValue", e.STORE_NAME_MESSAGE_LOG = "messages", e.STORE_NAME_MAIN_LOG = "log", e.STORE_NAME_INBOX_MESSAGES = "inboxMessages", e.KEY_PATH_BASE_INCREMENT = "id";

Note that it's stripped the parentheses, and it's now all on a single line, which is much harder to read.

Expected behavior

It should most likely retain the parentheses around each expression, and when the expression list is above a certain length, it should put each on its own line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions