Skip to content

Commit

Permalink
fix: disallow line break between async and property (#11947)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Aug 10, 2020
1 parent 008fe25 commit 3bff1ce
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/babel-generator/src/generators/methods.js
Expand Up @@ -37,6 +37,8 @@ export function _methodHead(node: Object) {
}

if (node.async) {
// ensure `async` is in the same line with property name
this._catchUp("start", key.loc);
this.word("async");
this.space();
}
Expand Down
@@ -0,0 +1,4 @@
class Test {
@TestDecorator
async decorateMe() {}
}
@@ -0,0 +1,4 @@
{
"retainLines": true,
"plugins": [["decorators", { "decoratorsBeforeExport": true }]]
}
@@ -0,0 +1,3 @@
class Test {
@TestDecorator
async decorateMe() {}}

0 comments on commit 3bff1ce

Please sign in to comment.