-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
area:binary expressionsarea:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentsarea:idempotencyIssues with re-printing Prettier’s outputIssues with re-printing Prettier’s outputlang:javascriptIssues affecting JSIssues affecting JS
Description
Prettier 1.19.1
Playground link
--parser babelInput:
function binaryInBinaryLeft() {
return (
// Reason for 42
42
) * 84 + 2
}
function binaryInBinaryRight() {
return (
// Reason for 42
42
) + 84 * 2
}
function conditional() {
return (
// Reason for 42
42
) ? 1 : 2
}
function binaryInConditional() {
return (
// Reason for 42
42
) * 3 ? 1 : 2
}Output:
function binaryInBinaryLeft() {
return (
// Reason for 42
42 *
84 +
2
);
}
function binaryInBinaryRight() {
return (
// Reason for 42
42 +
84 * 2
);
}
function conditional() {
return (
// Reason for 42
42
? 1
: 2
);
}
function binaryInConditional() {
return (
// Reason for 42
42 * 3
? 1
: 2
);
}Second Output:
function binaryInBinaryLeft() {
return (
// Reason for 42
42 * 84 + 2
);
}
function binaryInBinaryRight() {
return (
// Reason for 42
42 + 84 * 2
);
}
function conditional() {
return (
// Reason for 42
42 ? 1 : 2
);
}
function binaryInConditional() {
return (
// Reason for 42
42 * 3 ? 1 : 2
);
}Expected behavior:
Second output should not change
Issue found in #7565 , tests in file https://github.com/prettier/prettier/blob/next/tests/comments/return-statement.js
Metadata
Metadata
Assignees
Labels
area:binary expressionsarea:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentsarea:idempotencyIssues with re-printing Prettier’s outputIssues with re-printing Prettier’s outputlang:javascriptIssues affecting JSIssues affecting JS