fix: format JSX Fragment correctly, consider Fragment as block (#6398)
This commit is contained in:
1 parent
f49b18e7c3
commit
257fba9b30
4 files changed
+52
-1
No files matched your search
@@ -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
|
||||||
|
```
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
const IMPORT_REGEX = /^import\s/;
|
const IMPORT_REGEX = /^import\s/;
|
||||||
const EXPORT_REGEX = /^export\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 COMMENT_REGEX = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->";
|
||||||
const EMPTY_NEWLINE = "\n\n";
|
const EMPTY_NEWLINE = "\n\n";
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,12 @@ printWidth: 80
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<>
|
||||||
|
test <World /> test
|
||||||
|
</> 123
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
| Column 1 | Column 2 |
|
| Column 1 | Column 2 |
|
||||||
|---|---|
|
|---|---|
|
||||||
| Text | <Hello>Text</Hello> |
|
| Text | <Hello>Text</Hello> |
|
||||||
@@ -299,6 +305,12 @@ printWidth: 80
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<>
|
||||||
|
test <World /> test
|
||||||
|
</> 123
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
| Column 1 | Column 2 |
|
| Column 1 | Column 2 |
|
||||||
| -------- | ------------------- |
|
| -------- | ------------------- |
|
||||||
| Text | <Hello>Text</Hello> |
|
| Text | <Hello>Text</Hello> |
|
||||||
@@ -342,6 +354,12 @@ semi: false
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<>
|
||||||
|
test <World /> test
|
||||||
|
</> 123
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
| Column 1 | Column 2 |
|
| Column 1 | Column 2 |
|
||||||
|---|---|
|
|---|---|
|
||||||
| Text | <Hello>Text</Hello> |
|
| Text | <Hello>Text</Hello> |
|
||||||
@@ -376,6 +394,12 @@ semi: false
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<>
|
||||||
|
test <World /> test
|
||||||
|
</> 123
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
| Column 1 | Column 2 |
|
| Column 1 | Column 2 |
|
||||||
| -------- | ------------------- |
|
| -------- | ------------------- |
|
||||||
| Text | <Hello>Text</Hello> |
|
| Text | <Hello>Text</Hello> |
|
||||||
|
|||||||
@@ -27,6 +27,12 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<>
|
||||||
|
test <World /> test
|
||||||
|
</> 123
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
| Column 1 | Column 2 |
|
| Column 1 | Column 2 |
|
||||||
|---|---|
|
|---|---|
|
||||||
| Text | <Hello>Text</Hello> |
|
| Text | <Hello>Text</Hello> |
|
||||||
Reference in new issue
Block a user