Skip to content

Comment within the arrow function's empty parameters was placed incorrectly after the fat arrow operator #18208

@Dunqing

Description

@Dunqing

Prettier 3.6.2
Playground link

--parser babel

Input:

Original source file: https://github.com/prettier/prettier/blob/011791fd6c8856fb92fafec95930e10383ac267b/tests/format/js/last-argument-expansion/dangling-comment-in-arrow-function.js

(
  // foo
) => {}

Output:

() =>
  // foo
  {};

Expected output:

foo(
  (
    // foo
  ) => {},
);

Why?

Should be the same as the input; this is what the user wants

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions