#### MDX: fix text with whitespace after JSX trim incorrectly ([#6340] by [@JounQin])
Previous versions format text with whitespace after JSX incorrectly in mdx, this has been fixed in this version.
```md
# Heading
Your username is @{{name}}
Hi {{firstName}} {{lastName}}
// Output (Prettier stable)Your username is @ {{name}}
Hi {{firstName}} {{lastName}}
// Output (Prettier master)Your username is @{{name}}
Hi {{firstName}} {{lastName}}
``` ### Handlebars: Improve comment formatting ([#6206] by [@gavinjoyce]) Previously, Prettier would sometimes ignore whitespace when formatting comments. ```hbs // InputSome escaped characters: < > &
// Output (Prettier stable)Some escaped characters: < > &
// Output (Prettier master)Some escaped characters: < > &
``` #### JavaScript: Stop moving comments inside tagged template literals ([#6236] by [@sosukesuzuki]) Previously, Prettier would move comments after the tag inside the template literal. This version fixes this problem. ```js // Input foo //comment ` `; // Output (Prettier stable) foo` // comment `; // Output (Prettier master) foo // comment ` `; ``` #### JavaScript: Fix moving comments in function calls like `useEffect` second argument ([#6270] by [@sosukesuzuki]) This fixes a bug that was affecting function calls that have a arrow function as first argument and an array expression as second argument, such as the common React's `useEffect`. A comment in its own line before the second argument would be moved to the line above. The bug was only present when using the Flow and TypeScript parsers. ```js // Input useEffect( () => { console.log("some code", props.foo); }, // We need to disable the eslint warning here, // because of some complicated reason. // eslint-disable line react-hooks/exhaustive-deps [] ); // Output (Prettier stable) useEffect(() => { console.log("some code", props.foo); }, // We need to disable the eslint warning here, // because of some complicated reason. // eslint-disable line react-hooks/exhaustive-deps []); // Output (Prettier master) useEffect( () => { console.log("some code", props.foo); }, // We need to disable the eslint warning here, // because of some complicated reason. // eslint-disable line react-hooks/exhaustive-deps [] ); ``` #### TypeScript: Fix crashes when using `//` in JSX texts ([#6289] by [@duailibe]) This version updates the TypeScript parser to correctly handle JSX text with double slashes (`//`). In previous versions, this would cause Prettier to crash. #### CLI: Add `--only-changed` flag ([#5910] by [@g-harel]) Flag used with `--write` to avoid re-checking files that were not changed since they were last written (with the same formatting configuration). #### HTML, Vue: Don't break the template element included in a line shorter than print-width([#6284] by [@sosukesuzuki]) Previously, even if the line length is shorter than print-width is Prettier breaks the line with a template element. ```html // Input foo // Output (Prettier stable) foo // Output (Prettier master) foo ``` #### JavaScript: Fix breaks indentation and idempotency when an arrow function that args include object pattern is passed to a function as parameter. ([#6301] by [@sosukesuzuki]) Previously, Prettier collapses strangely, when an arrow function that args include object pattern is passed to a function as parameter. Also, it breaks idempotency. Please see [#6294](https://github.com/prettier/prettier/issues/6294) for detail. ```js // Input foo( ({ a, b }) => {} ); // Output (Prettier stable) foo(({ a, b }) => {}); // Output (Prettier master) foo( ({ a, b }) => {} ); ``` #### TypeScript: Fix specific union type breaks after opening parenthesis, but not before closing ([#6307] by [@sosukesuzuki]) Previously, union type that put with `as` , `keyof`, `[]`, other union(`|`) and intersection(`&`) breaks after opening parenthesis, but not before closing. Please see [#6303](https://github.com/prettier/prettier/issues/6303) for detail. ```ts // Input const foo = [abc, def, ghi, jkl, mno, pqr, stu, vwx, yz] as ( | string | undefined )[]; // Prettier (stable) const foo = [abc, def, ghi, jkl, mno, pqr, stu, vwx, yz] as ( | string | undefined)[]; // Prettier (master) const foo = [abc, def, ghi, jkl, mno, pqr, stu, vwx, yz] as ( | string | undefined )[]; ``` [#5910]: https://github.com/prettier/prettier/pull/5910 [#6186]: https://github.com/prettier/prettier/pull/6186 [#6206]: https://github.com/prettier/prettier/pull/6206 [#6209]: https://github.com/prettier/prettier/pull/6209 [#6217]: https://github.com/prettier/prettier/pull/6217 [#6234]: https://github.com/prettier/prettier/pull/6234 [#6236]: https://github.com/prettier/prettier/pull/6236 [#6270]: https://github.com/prettier/prettier/pull/6270 [#6289]: https://github.com/prettier/prettier/pull/6289 [#6332]: https://github.com/prettier/prettier/pull/6332 [#6284]: https://github.com/prettier/prettier/pull/6284 [#6301]: https://github.com/prettier/prettier/pull/6301 [#6307]: https://github.com/prettier/prettier/pull/6307 [#6340]: https://github.com/prettier/prettier/pull/6340 [@duailibe]: https://github.com/duailibe [@gavinjoyce]: https://github.com/gavinjoyce [@sosukesuzuki]: https://github.com/sosukesuzuki [@g-harel]: https://github.com/g-harel [@jounqin]: https://github.com/JounQin