Files
test-repo/tests/js/binary-expressions/comment.js
T
Sosuke SuzukiandGeorgii Dolzhykov 9c67e7b7f1 JavaScript: Fix indentation for binary expressions with trailing comments (#8476)
* Modify to align binaryish expression with trailing comment

* Add tests

* Add comment

* Add test

* Add changelog

* Fix by lint

* Modify to move transformation to printBinaryishExpressions

* Remove unnecessary new line

* Fix hasTrailingCommentInBinaryish

* Add shouldReturnParts option to printComments

* Add tests from review

* Fix by lint

* Extract and use normalizeParts

* Group CallExpression when parent node is binaryish

* Fix by lint

* Remove unnecessary change

* Wrap the doc of most left node with group

* Add tests

* Update pr-8476.md

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-06-04 08:59:05 +03:00

54 lines
867 B
JavaScript

a = (
// Comment 1
(Math.random() * (yRange * (1 - minVerticalFraction)))
+ (minVerticalFraction * yRange)
) - offset;
a +
a +
a + // comment
a +
a;
a &&
longLongLongLongLongLongLongLongLong &&
longLongLongLongLongLongLongLongLong && // comment
longLongLongLongLongLongLongLongLong &&
longLongLongLongLongLongLongLongLong
a ||
longLongLongLongLongLongLongLongLong ||
longLongLongLongLongLongLongLongLong || // comment
longLongLongLongLongLongLongLongLong ||
longLongLongLongLongLongLongLongLong
var a = x(abifornCringerMoshedPerplexSawder
+ kochabCooieGameOnOboleUnweave // f
+ glimseGlyphsHazardNoopsTieTie+bifornCringerMoshedPerplexSawder);
foo[
a +
a + // comment
a +
bar[
b +
b +
b + // comment
b +
b
]
];
!(
a +
a + // comment
a +
!(
b +
b +
b + // comment
b +
b
)
);