Skip to content

formatter: Diff with Prettier on single-line comments in an empty enum #21145

@mkrl

Description

@mkrl

Input

type Foo = {
  // Type comment
};

interface Bar {
  // Interface comment
}

enum Baz {
  // Enum comment, this will break after formatting
}

Config

{}

Oxfmt output

Oxfmt version: latest

type Foo = {
  // Type comment
};

interface Bar {
  // Interface comment
}

enum Baz {// Enum comment, this will break after formatting}

Oxfmt playground link

click

Prettier output

Prettier version: 3.8.1

type Foo = {
  // Type comment
};

interface Bar {
  // Interface comment
}

enum Baz {
  // Enum comment, this will break after formatting
}

Prettier playground link

click

Additional notes

A fairly rare case of an empty enum with a single-line comment inside.

Formatting causes terminating brace on an enum to be a part of the comment. This doesn't seem to be the case for other similar declarations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions