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

Remove needless conditions for YeildExpression in needs-parens #13790

Merged
merged 1 commit into from Nov 6, 2022
Merged
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
7 changes: 1 addition & 6 deletions src/language-js/needs-parens.js
Expand Up @@ -349,12 +349,7 @@ function needsParens(path, options) {
}

case "YieldExpression":
if (
parent.type === "UnaryExpression" ||
parent.type === "AwaitExpression" ||
parent.type === "TSAsExpression" ||
parent.type === "TSNonNullExpression"
Comment on lines -353 to -356
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnaryExpression, TSAsExpression and TSNonNullExpression are treated on https://github.com/prettier/prettier/blob/next/src/language-js/needs-parens.js#L368-L370 so this change no affects for format result.

) {
if (parent.type === "AwaitExpression") {
return true;
}
// else fallthrough
Expand Down