-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add preceding semicolon on await insertion when parentheses are included #34627
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks
eba0325
to
c15b40e
Compare
c15b40e
to
d743f0d
Compare
index: 0, | ||
newFileContent: | ||
`async function fn(a: Promise<{ x: string }>) { | ||
console.log(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this have ;
after console.log and on that line instead of next line ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually the typical preferred style for non-semicoloners. See https://standardjs.com/rules.html#semicolons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @orta to confirm people actually do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier does it this way, to which I give more credence than StandardJS anyway. I feel good about keeping it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, confirming, this is what I'm used to
@@ -257,6 +257,7 @@ namespace ts.codefix { | |||
sourceFile, | |||
insertionSite.parent.expression, | |||
createParen(createAwait(insertionSite.parent.expression))); | |||
insertLeadingSemicolonIfNeeded(changeTracker, insertionSite.parent.expression, sourceFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insertLeadingSemicolonIfNeeded(changeTracker, insertionSite.parent.expression, sourceFile); | |
insertLeadingSemicolonIfNeeded(changeTracker, insertionSite.parent.expression, sourceFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current indentation is correct (the preceding three lines are arguments to replaceNode
; this is not)
Fixes #33522