fix: format JSX Fragment correctly, consider Fragment as block (#6398)

This commit is contained in:
JounQin authored and Georgii Dolzhykov committed 2019-11-18 13:06:48 +02:00
1 parent f49b18e7c3
commit 257fba9b30
4 files changed
+52 -1

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
#### MDX: fix JSX Fragment format incorrectly ([#6398](https://github.com/prettier/prettier/pull/6398) by [@JounQin](https://github.com/JounQin))
Previous versions format JSX Fragment incorrectly in mdx, this has been fixed in this version.
<!-- prettier-ignore -->
```md
<!-- Input -->
<>
test <World /> test
</> 123
<!-- Output (Prettier stable) -->
<>
test <World /> test
</> 123
<!-- Output (Prettier master) -->
<>
test <World /> test
</> 123
```
+1 -1
View File
@@ -26,7 +26,7 @@
const IMPORT_REGEX = /^import\s/;
const EXPORT_REGEX = /^export\s/;
const BLOCKS_REGEX = "[a-z\\.]*(\\.){0,1}[a-z][a-z0-9\\.]*";
const BLOCKS_REGEX = "[a-z][a-z0-9]*(\\.[a-z][a-z0-9]*)*|";
const COMMENT_REGEX = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->";
const EMPTY_NEWLINE = "\n\n";
@@ -265,6 +265,12 @@ printWidth: 80
---
<>
test <World /> test
</> 123
---
| Column 1 | Column 2 |
|---|---|
| Text | <Hello>Text</Hello> |
@@ -299,6 +305,12 @@ printWidth: 80
---
<>
test <World /> test
</> 123
---
| Column 1 | Column 2 |
| -------- | ------------------- |
| Text | <Hello>Text</Hello> |
@@ -342,6 +354,12 @@ semi: false
---
<>
test <World /> test
</> 123
---
| Column 1 | Column 2 |
|---|---|
| Text | <Hello>Text</Hello> |
@@ -376,6 +394,12 @@ semi: false
---
<>
test <World /> test
</> 123
---
| Column 1 | Column 2 |
| -------- | ------------------- |
| Text | <Hello>Text</Hello> |
+6
View File
@@ -27,6 +27,12 @@
---
<>
test <World /> test
</> 123
---
| Column 1 | Column 2 |
|---|---|
| Text | <Hello>Text</Hello> |