Fix comments inside JSX attributes (#14082)

Fixes https://github.com/prettier/prettier/issues/11242
This commit is contained in:
fisker Cheung authored and GitHub committed 2022-12-30 10:36:58 +08:00
1 parent ef707da0a2
commit e301b1f9ce
5 files changed
+111 -2

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
#### Fix formatting for comments inside JSX attribute (#14082 with by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
function MyFunctionComponent() {
<button label=/*old*/"new">button</button>
}
// Prettier stable
Error: Comment "old" was not printed. Please report this error!
// Prettier main
function MyFunctionComponent() {
<button label=/*old*/ "new">button</button>;
}
```