forked from prettier/prettier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix/ Don't inline pipeline operator with leading ownline comment (p…
…rettier#5015) * don't inline pipeline operator with leading ownline comment * Add tests for comments surrounded with binary expressions * Add babylon test for ownlinecomment with pipeline operator
- Loading branch information
Showing
6 changed files
with
243 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
function addition() { | ||
0 | ||
// Comment | ||
+ x | ||
} | ||
|
||
function multiplication() { | ||
0 | ||
// Comment | ||
* x | ||
} | ||
|
||
function division() { | ||
0 | ||
// Comment | ||
/ x | ||
} | ||
|
||
function substraction() { | ||
0 | ||
// Comment | ||
- x | ||
} | ||
|
||
function remainder() { | ||
0 | ||
// Comment | ||
% x | ||
} | ||
|
||
function exponentiation() { | ||
0 | ||
// Comment | ||
** x | ||
} | ||
|
||
function leftShift() { | ||
0 | ||
// Comment | ||
<< x | ||
} | ||
|
||
function rightShift() { | ||
0 | ||
// Comment | ||
>> x | ||
} | ||
|
||
function unsignedRightShift() { | ||
0 | ||
// Comment | ||
>>> x | ||
} | ||
|
||
function bitwiseAnd() { | ||
0 | ||
// Comment | ||
& x | ||
} | ||
|
||
function bitwiseOr() { | ||
0 | ||
// Comment | ||
| x | ||
} | ||
|
||
function bitwiseXor() { | ||
0 | ||
// Comment | ||
^ x | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/comments_pipeline_own_line/__snapshots__/jsfmt.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`pipeline_own_line.js - babylon-verify 1`] = ` | ||
function pipeline() { | ||
0 | ||
// Comment | ||
|> x | ||
} | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
function pipeline() { | ||
0 |> | ||
// Comment | ||
x; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
run_spec(__dirname, ["babylon"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function pipeline() { | ||
0 | ||
// Comment | ||
|> x | ||
} |