Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Print multi-line inner comments of arrowFunc #15159

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/babel-generator/src/generators/methods.ts
Expand Up @@ -196,6 +196,8 @@ export function ArrowFunctionExpression(
// We forcefully print inner comments here.
this.printInnerComments();
this.token("=>");
// For multiline comments
this.printInnerComments();

this.space();

Expand Down
@@ -1 +1 @@
var test = () => {};
var test = () => {};
6 changes: 3 additions & 3 deletions packages/babel-generator/test/index.js
Expand Up @@ -1161,9 +1161,9 @@ describe("programmatic generation", function () {
{ type: "CommentBlock", value: "new\nline" },
];
expect(generate(arrow).code).toMatchInlineSnapshot(`
"(x, y) /*foo*/ => z
/*new
line*/"
"(x, y) /*foo*/ =>
/*new
line*/ z"
`);
});

Expand Down