-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
lang:javascriptIssues affecting JSIssues affecting JS
Description
Prettier 3.6.2
Playground link
--parser acornInput:
func(() => // comment
(a , b , c))
func(
() =>
(
// comment
a, b, c
),
);
(
// comment
a, b, c
);Output:
func(
() =>
// comment
(a, b, c),
);
func(
() =>
// comment
(a, b, c),
);
// comment
(a, b, c);Expected output:
- Place comments inside the sequence expression
func(
() =>
(
// comment
a, b, c
),
);
func(
() =>
(
// comment
a, b, c
),
);
(
// comment
a, b, c
)- Keep the comments place as-is
func(
() =>
// comment
(a, b, c),
);
func(
() =>
(
// comment
a, b, c
),
);
(
// comment
a, b, c
)Why?
I think the comment, if the sequence expression wraps it, then the output should keep it in the same place. However, it was placed before the sequence expression anyway.
Not sure which output is better, here are my thoughts on the two different results:
- The first one maintains consistency as long as the comments precede the first expression of the sequence.
- The second one keeps the comments in the same place as the input.
Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JS