Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YAML: Fix printing doubles a blank line before a comment (#9143)
* Print hardline for endComments only when under mappingValue * Add changelog * Fix from linter * Update tests * Use shouldPrintEndCommentsWithAlign * Add tests * Add test * Fix format * Update test * Test map too * Update tests * `shouldPrintEndCommentsWithAlign` -> `shouldPrintEndComments` Co-authored-by: fisker <lionkay@gmail.com>
- Loading branch information
1 parent
1a89b34
commit 5f9bb25
Showing
7 changed files
with
322 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#### Fix printing doubles a blank line before a comment (#9143 by @sosukesuzuki) | ||
|
||
<!-- prettier-ignore --> | ||
```yaml | ||
# Input | ||
- foo: 0 | ||
bar: 1 | ||
|
||
# baz: 2 | ||
- quux: 3 | ||
|
||
# Prettier stable | ||
- foo: 0 | ||
bar: 1 | ||
|
||
|
||
# baz: 2 | ||
- quux: 3 | ||
|
||
# Prettier master | ||
- foo: 0 | ||
bar: 1 | ||
|
||
# baz: 2 | ||
- quux: 3 | ||
|
||
``` |
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,13 @@ | ||
- foo: 0 | ||
bar: 1 | ||
|
||
# baz: 2 | ||
- quux: 3 | ||
|
||
- foo: 0 | ||
bar: 1 | ||
|
||
# baz: 2 | ||
|
||
# baz: 3 | ||
- quux: 3 |
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,28 @@ | ||
before: | ||
|
||
# before.comment | ||
after: | ||
# after.comment | ||
|
||
before-after: | ||
|
||
# before-after.comment | ||
|
||
none: | ||
# none.comment | ||
before(2 line): | ||
|
||
|
||
# before.comment | ||
after(2 line): | ||
# after.comment | ||
|
||
|
||
before-after(2 line): | ||
|
||
|
||
# before-after.comment | ||
|
||
|
||
none(2): | ||
# none.comment |
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,28 @@ | ||
- before | ||
|
||
# before.comment | ||
- after | ||
# after.comment | ||
|
||
- before-after | ||
|
||
# before-after.comment | ||
|
||
- none: | ||
# none.comment | ||
- before(2 line) | ||
|
||
|
||
# before.comment | ||
- after(2 line) | ||
# after.comment | ||
|
||
|
||
- before-after(2 line) | ||
|
||
|
||
# before-after.comment | ||
|
||
|
||
- none(2) | ||
# none.comment |
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,13 @@ | ||
- - a | ||
|
||
# - b | ||
|
||
# - c | ||
|
||
- e | ||
|
||
- - a | ||
|
||
# - b | ||
|
||
# - c |