diff --git a/changelog_unreleased/blog-post-intro.md b/changelog_unreleased/blog-post-intro.md new file mode 100644 index 000000000000..166e4bd1ae35 --- /dev/null +++ b/changelog_unreleased/blog-post-intro.md @@ -0,0 +1,7 @@ +--- +author: "Sosuke Suzuki (@sosukesuzuki)" +authorURL: "https://github.com/sosukesuzuki" +title: "Prettier 2.2: new JavaScript parsers, TS 4.1 and ESM standalone bundles" +--- + +This release supports new JavaScript parsers [espree](https://github.com/eslint/espree) and [meriyah](https://github.com/meriyah/meriyah), supports [TypeScript 4.1](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-rc/), ships ESM standalone bundles for modern browsers, and includes many bug fixes and improvements! diff --git a/changelog_unreleased/cli/pr-8937.md b/changelog_unreleased/cli/pr-8937.md new file mode 100644 index 000000000000..ad053189be2b --- /dev/null +++ b/changelog_unreleased/cli/pr-8937.md @@ -0,0 +1,12 @@ +#### Move [pre-commit](https://github.com/pre-commit/pre-commit) support to github.com/pre-commit/mirrors-prettier ([#8937](https://github.com/prettier/prettier/pull/8937) by [@FloChehab](https://github.com/FloChehab)) + +`pre-commit` support has moved to https://github.com/pre-commit/mirrors-prettier, please update your `.pre-commit-config.yaml` file . + +```diff +- - repo: https://github.com/prettier/prettier ++ - repo: https://github.com/pre-commit/mirrors-prettier +- rev: "2.2.0" ++ rev: "v2.2.0" + hooks: + - id: prettier +``` diff --git a/changelog_unreleased/css/pr-9209.md b/changelog_unreleased/css/pr-9209.md deleted file mode 100644 index 2a3f7f2442fa..000000000000 --- a/changelog_unreleased/css/pr-9209.md +++ /dev/null @@ -1,42 +0,0 @@ -#### Improve formatting for custom properties (#9209 by @fisker) - -Thanks to [`PostCSS 8.0`](https://github.com/postcss/postcss/releases/tag/8.0.0), we can handle these edge cases on custom properties. - - -```css -/* Input */ -:root { - --empty: ; - --JSON: [1, "2", {"three": {"a":1}}, [4]]; - --javascript: function(rule) { console.log(rule) }; -} - -@supports (--element(".minwidth", { "minWidth": 300 })) { - [--self] { - background: greenyellow; - } -} - -/* Prettier stable */ -SyntaxError: (postcss) CssSyntaxError Missed semicolon (3:20) - 1 | :root { - 2 | --empty: ; -> 3 | --JSON: [1, "2", {"three": {"a":1}}, [4]]; - | ^ - 4 | --javascript: function(rule) { console.log(rule) }; - 5 | } - 6 | - -/* Prettier master */ -:root { - --empty: ; - --JSON: [1, "2", {"three": {"a": 1}}, [4]]; - --javascript: function(rule) {console.log(rule)}; -} - -@supports (--element(".minwidth", {"minWidth": 300})) { - [--self] { - background: greenyellow; - } -} -``` diff --git a/changelog_unreleased/flow/pr-9543.md b/changelog_unreleased/flow/pr-9543.md index bc6582b498fa..c328264ae0f1 100644 --- a/changelog_unreleased/flow/pr-9543.md +++ b/changelog_unreleased/flow/pr-9543.md @@ -7,7 +7,7 @@ const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; -// Prettier master +// Prettier stable const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo< symbol > = a; @@ -18,7 +18,7 @@ const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo 0 > = a; -// Prettier stable (typescript and flow parser) +// Prettier master (typescript and flow parser) const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; diff --git a/changelog_unreleased/flow/pr-9563.md b/changelog_unreleased/flow/pr-9563.md index 8260bb391b9f..0c843229d70b 100644 --- a/changelog_unreleased/flow/pr-9563.md +++ b/changelog_unreleased/flow/pr-9563.md @@ -8,13 +8,13 @@ class Foo { bar( data: Array) {} } -// Prettier master +// Prettier stable foo/*:: */(baz); class Foo { bar(data: Array/*:: */) {} } -// Prettier stable +// Prettier master foo/*:: */(baz); class Foo { bar(data: Array) {} diff --git a/changelog_unreleased/typescript/pr-9473.md b/changelog_unreleased/typescript/pr-9473.md index 1c0f69efdbe0..bba25de1bed1 100644 --- a/changelog_unreleased/typescript/pr-9473.md +++ b/changelog_unreleased/typescript/pr-9473.md @@ -1,6 +1,6 @@ -#### [HIGHLIGHT]Support TypeScript 4.1 (#9473, #9636 by @sosukesuzuki) +#### [HIGHLIGHT]Support [TypeScript 4.1](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/) (#9473, #9636 by @sosukesuzuki) -##### Key Remapping In Mapped Types +##### [Key Remapping In Mapped Types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#key-remapping-in-mapped-types) ```ts // Input @@ -8,31 +8,31 @@ type MappedTypeWithNewKeys = { [K in keyof T as NewKeyType]: T[K] }; -// Prettier master +// Prettier stable SyntaxError: Unexpected token, expected "]" (2:17) 1 | type MappedTypeWithNewKeys = { > 2 | [K in keyof T as NewKeyType]: T[K] | ^ 3 | }; -// Prettier stable +// Prettier master type MappedTypeWithNewKeys = { [K in keyof T as NewKeyType]: T[K] }; ``` -##### Template Literal Types +##### [Template Literal Types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#template-literal-types) ```ts // Input type HelloWorld = `Hello, ${keyof World}` -// Prettier master +// Prettier stable SyntaxError: Unexpected token, expected "}" (1:35) > 1 | type HelloWorld = `Hello, ${keyof World}` | ^ -// Prettier stable +// Prettier master type HelloWorld = `Hello, ${keyof World}`; ``` diff --git a/changelog_unreleased/typescript/pr-9484.md b/changelog_unreleased/typescript/pr-9484.md index 7b2634ce716a..5b0ad899a0e8 100644 --- a/changelog_unreleased/typescript/pr-9484.md +++ b/changelog_unreleased/typescript/pr-9484.md @@ -5,9 +5,9 @@ // Input foo = { bar: (a = b) }; -// Prettier master +// Prettier stable foo = { bar: a = b }; -// Prettier stable +// Prettier master foo = { bar: (a = b) }; ``` diff --git a/changelog_unreleased/typescript/pr-9521.md b/changelog_unreleased/typescript/pr-9521.md index 9d63819f9daf..6229c17cf06d 100644 --- a/changelog_unreleased/typescript/pr-9521.md +++ b/changelog_unreleased/typescript/pr-9521.md @@ -7,18 +7,18 @@ const name: SomeGeneric< Pick > = null; -// Prettier master (--parser=typescript) +// Prettier stable (--parser=typescript) const name: SomeGeneric> = null; -// Prettier master (--parser=flow) +// Prettier stable (--parser=flow) const name: SomeGeneric< Pick > = null; -// Prettier stable (typescript and flow parser) +// Prettier master (typescript and flow parser) const name: SomeGeneric< Pick > = null; diff --git a/changelog_unreleased/typescript/pr-9551.md b/changelog_unreleased/typescript/pr-9551.md index 77ffc2676f6f..83394a7f8a91 100644 --- a/changelog_unreleased/typescript/pr-9551.md +++ b/changelog_unreleased/typescript/pr-9551.md @@ -8,13 +8,13 @@ type a= { [A in B]: C | D } -// Prettier master +// Prettier stable type a = { // prettier-ignore A in B: C | D; }; -// Prettier stable +// Prettier master type a = { // prettier-ignore [A in B]: C | D diff --git a/website/blog/2020-11-20-2.2.0.md b/website/blog/2020-11-20-2.2.0.md new file mode 100644 index 000000000000..03f05691e562 --- /dev/null +++ b/website/blog/2020-11-20-2.2.0.md @@ -0,0 +1,1135 @@ +--- +author: "Sosuke Suzuki (@sosukesuzuki)" +authorURL: "https://github.com/sosukesuzuki" +title: "Prettier 2.2: new JavaScript parsers, TS 4.1 and ESM standalone bundles" +--- + +This release supports new JavaScript parsers [espree](https://github.com/eslint/espree) and [meriyah](https://github.com/meriyah/meriyah), supports [TypeScript 4.1](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-rc/), ships ESM standalone bundles for modern browsers, and includes many bug fixes and improvements! + + + +## Highlights + +### JavaScript + +#### Add `espree` and `meriyah` parser ([#9000](https://github.com/prettier/prettier/pull/9000), [#9514](https://github.com/prettier/prettier/pull/9514) by [@fisker](https://github.com/fisker)) + +Two new values for the `parser` option has been added: + +- [`espree`](https://github.com/eslint/espree) - which is the default parser used by [`ESLint`](https://github.com/eslint/eslint). + + Note that `espree` only works for [Finished ECMAScript Proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md), and is stricter than the `babel` parser. + +- [`meriyah`](https://github.com/meriyah/meriyah) - A [fast](https://meriyah.github.io/meriyah/performance/) JavaScript parser, successor of [cherow](https://github.com/cherow/cherow). + +### TypeScript + +#### Support [TypeScript 4.1](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/) ([#9473](https://github.com/prettier/prettier/pull/9473), [#9636](https://github.com/prettier/prettier/pull/9636) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +##### [Key Remapping In Mapped Types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#key-remapping-in-mapped-types) + +```ts +// Input +type MappedTypeWithNewKeys = { + [K in keyof T as NewKeyType]: T[K] +}; + +// Prettier 2.1 +SyntaxError: Unexpected token, expected "]" (2:17) + 1 | type MappedTypeWithNewKeys = { +> 2 | [K in keyof T as NewKeyType]: T[K] + | ^ + 3 | }; + +// Prettier 2.2 +type MappedTypeWithNewKeys = { + [K in keyof T as NewKeyType]: T[K] +}; +``` + +##### [Template Literal Types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#template-literal-types) + +```ts +// Input +type HelloWorld = `Hello, ${keyof World}` + +// Prettier 2.1 +SyntaxError: Unexpected token, expected "}" (1:35) +> 1 | type HelloWorld = `Hello, ${keyof World}` + | ^ + +// Prettier 2.2 +type HelloWorld = `Hello, ${keyof World}`; + +``` + +### API + +#### ESM standalone bundles ([#8983](https://github.com/prettier/prettier/pull/8983) by [@Monchi](https://github.com/Monchi), [@fisker](https://github.com/fisker)) + +Prettier now also comes as ES modules, which can be directly used in modern browsers: + +```js +import prettier from "https://unpkg.com/prettier/esm/standalone.mjs"; +import parserGraphql from "https://unpkg.com/prettier/esm/parser-graphql.mjs"; + +prettier.format("query { }", { + parser: "graphql", + plugins: [parserGraphql], +}); +``` + +## Other changes + +### JavaScript + +#### Respect spacing between template values in embedded CSS ([#9078](https://github.com/prettier/prettier/pull/9078) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```js +// Input +const style = css` + width: ${size}${sizeUnit}; +`; + +// Prettier 2.1 +const style = css` + width: ${size} ${sizeUnit}; +`; + +// Prettier 2.2 +const style = css` + width: ${size}${sizeUnit}; +`; + +``` + +#### Fix comments inside template literals with embedded syntax ([#9278](https://github.com/prettier/prettier/pull/9278) by [@fisker](https://github.com/fisker)) + + +```js +// Input +html`${ + foo + /* comment */ +}`; +html` +${ + foo + /* comment */ +} +`; +graphql`${ + foo + /* comment */ +}`; +css`${ + foo + /* comment */ +}`; + +// Prettier 2.1 +html`${foo}`; +/* comment */ +html` + ${foo} + /* comment */ +`; +graphql` + ${foo} + /* comment */ +`; +css` + ${foo} + /* comment */ +`; + + +// Prettier 2.2 +html`${ + foo + /* comment */ +}`; +html` +${ + foo + /* comment */ +} +`; +graphql`${ + foo + /* comment */ +}`; +css`${ + foo + /* comment */ +}`; +``` + +#### Improve formatting for assignments of classes with long superclass names ([#9341](https://github.com/prettier/prettier/pull/9341) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +This improves the formatting for [Google Closure Library namespaces](https://developers.google.com/closure/library/docs/introduction#names). + + +```js +// Input +aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends ( + aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg1 +) { + method () { + console.log("foo"); + } +}; + +// Prettier 2.1 +aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends aaaaaaaa + .bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg1 { + method() { + console.log("foo"); + } +}; + +// Prettier 2.2 +aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg2 = class extends ( + aaaaaaaa.bbbbbbbb.cccccccc.dddddddd.eeeeeeee.ffffffff.gggggggg1 +) { + method() { + console.log("foo"); + } +}; + +``` + +#### Fix placement of leading comments for bodies of `while` statements ([#9345](https://github.com/prettier/prettier/pull/9345) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```js +// Input +while(1) // Comment + foo(); + +// Prettier 2.1 +while ( + 1 // Comment +) + foo(); + +// Prettier 2.2 +while (1) + // Comment + foo(); + +``` + +#### Update to `@babel/parser` 7.12 ([#9408](https://github.com/prettier/prettier/pull/9408), [#9476](https://github.com/prettier/prettier/pull/9476), [#9597](https://github.com/prettier/prettier/pull/9597) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +Updated the JavaScript parser to [`@babel/parser` 7.12](https://babeljs.io/blog/2020/10/15/7.12.0). This fixes several bugs and supports some new syntax. + +##### Support Import Assertions + +[The "module attributes" proposal supported on 2.1](https://prettier.io/blog/2020/08/24/2.1.0.html#support-es-module-attributes-and-json-modules-8436httpsgithubcomprettierprettierpull8436-by-fiskerhttpsgithubcomfisker) has been significantly changed and also renamed to "import assertions". + +```js +import foo from "./foo.json" assert { type: "json" }; +``` + +##### Support imports and exports with string names + +```js +let happy = "happy"; +export { happy as "😃" }; +``` + +##### Support class static blocks + +```js +class C { + static #x = 42; + static y; + static { + try { + this.y = doSomethingWith(this.#x); + } catch { + this.y = "unknown"; + } + } +} +``` + +#### Keep HTML and Markdown invalid template literals as is ([#9431](https://github.com/prettier/prettier/pull/9431) by [@fisker](https://github.com/fisker)) + + +```js +// Input +foo = html`
\u{prettier}
`; +foo = html`\u{prettier}${foo}pr\u{0065}ttier`; +foo = markdown`# \u{prettier}\u{0065}`; + +// Prettier 2.1 +foo = html``; +foo = html`null${foo}prettier`; +foo = markdown` +# \u{prettier}\u{0065} +`; + +// Prettier 2.2 +foo = html`
\u{prettier}
`; +foo = html`\u{prettier}${foo}pr\u{0065}ttier`; +foo = markdown`# \u{prettier}\u{0065}`; +``` + +#### Fix formatting for `import {a as a}` and `export {a as a}` ([#9435](https://github.com/prettier/prettier/pull/9435) by [@fisker](https://github.com/fisker)) + + +```js +// Input +import { a as a } from "a"; +export { b as b } from "b"; + +// Prettier 2.1 +import { a } from "a"; +export { b } from "b"; + +// Prettier 2.2 +import { a as a } from "a"; +export { b as b } from "b"; +``` + +#### Fix formatting of yielded JSX expressions ([#9650](https://github.com/prettier/prettier/pull/9650) by [@brainkim](https://github.com/brainkim)) + + +```jsx +// Input +function* f() { + yield
generator
+} +// Prettier 2.1 +function* f() { + yield (
generator
); +} +// Prettier 2.2 +function* f() { + yield
generator
; +} +``` + +#### Flatten function expression parameters in hugged last argument ([#9662](https://github.com/prettier/prettier/pull/9662) by [@thorn0](https://github.com/thorn0)) + + +```jsx +// Prettier 2.1 +function* mySagas() { + yield effects.takeEvery(rexpress.actionTypes.REQUEST_START, function* ({ + id + }) { + console.log(id); + yield rexpress.actions(store).writeHead(id, 400); + yield rexpress.actions(store).end(id, "pong"); + console.log("pong"); + }); +} + +// Prettier 2.2 +function* mySagas() { + yield effects.takeEvery( + rexpress.actionTypes.REQUEST_START, + function* ({ id }) { + console.log(id); + yield rexpress.actions(store).writeHead(id, 400); + yield rexpress.actions(store).end(id, "pong"); + console.log("pong"); + } + ); +} +``` + +#### Fix crash on `require(/* comment */)` ([#9670](https://github.com/prettier/prettier/pull/9670) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +require(/* comment */) + +// Prettier 2.1 +Error: Comment "comment" was not printed. Please report this error! + +// Prettier 2.2 +require(/* comment */); +``` + +### TypeScript + +#### Preserve the last separator in ignored object types and interfaces ([#9318](https://github.com/prettier/prettier/pull/9318) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```ts +// Input +let x: { + // prettier-ignore + y: z; +}; + +// Prettier 2.1 +let x: { + // prettier-ignore + y: z;; +}; + +// Prettier 2.2 +let x: { + // prettier-ignore + y: z; +}; +``` + +#### Add parens around assignments in object literal properties ([#9484](https://github.com/prettier/prettier/pull/9484) by [@fisker](https://github.com/fisker)) + + +```ts +// Input +foo = { bar: (a = b) }; + +// Prettier 2.1 +foo = { bar: a = b }; + +// Prettier 2.2 +foo = { bar: (a = b) }; +``` + +#### Fix inconsistencies in formatting of types between `typescript` and `flow` ([#9521](https://github.com/prettier/prettier/pull/9521) by [@fisker](https://github.com/fisker)) + + +```ts +// Input +const name: SomeGeneric< + Pick +> = null; + +// Prettier 2.1 (--parser=typescript) +const name: SomeGeneric> = null; + +// Prettier 2.1 (--parser=flow) +const name: SomeGeneric< + Pick +> = null; + +// Prettier 2.2 (typescript and flow parser) +const name: SomeGeneric< + Pick +> = null; +``` + +#### Fix `prettier-ignore`d mapped types ([#9551](https://github.com/prettier/prettier/pull/9551) by [@fisker](https://github.com/fisker)) + + +```ts +// Input +type a= { + // prettier-ignore + [A in B]: C | D + } + +// Prettier 2.1 +type a = { + // prettier-ignore + A in B: C | D; +}; + +// Prettier 2.2 +type a = { + // prettier-ignore + [A in B]: C | D + }; +``` + +### Flow + +#### Switch the `babel` parser to `babel-flow` if the `@flow` pragma is found ([#9071](https://github.com/prettier/prettier/pull/9071) by [@fisker](https://github.com/fisker)) + +In practice, this means that as long as your Flow files have the pragma, it's safe to use the `.js` extension for them. Prettier will correctly parse and print them without any additional configuration. Previously, the pragma was recognized by the parser, but there existed minor correctness issues with the printer. E.g. it's not safe to unquote number keys in Flow. + + +```jsx +// Input (with --parser babel) +// @flow +f({ "2": 2 }) + +// Prettier 2.1 +// @flow +f({ 2: 2 }); + +// Prettier 2.2 +// @flow +f({ "2": 2 }); +``` + +#### Enums with unknown members ([#9432](https://github.com/prettier/prettier/pull/9432) by [@gkz](https://github.com/gkz)) + +Previously, was not supported. Now, the following is formatted: + + +```jsx +// Input +enum E { + A, + B, + ... +} + +// Prettier 2.1: parse error + +// Prettier 2.2 +enum E { + A, + B, + ... +} +``` + +#### `this` parameter annotations ([#9457](https://github.com/prettier/prettier/pull/9457) by [@dsainati1](https://github.com/dsainati1), [#9489](https://github.com/prettier/prettier/pull/9489) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +function f(this: string, a: number) { +} + +type T = (this: boolean, a: number) => boolean; + +// Prettier 2.1 +function f(this: string, a: number) {} + +type T = (a: number) => boolean; + +// Prettier 2.2 +function f(this: string, a: number) { +} + +type T = (this: boolean, a: number) => boolean; +``` + +#### Support `BigIntLiteralTypeAnnotation` and `BigIntTypeAnnotation` ([#9523](https://github.com/prettier/prettier/pull/9523) by [@fisker](https://github.com/fisker)) + +Add support for `BigIntLiteralTypeAnnotation` and `BigIntTypeAnnotation` in Flow. + + +```jsx +// Input +const foo: bigint = 1n; +const bar: baz<1n> = 1n; + +// Prettier 2.1 +Error: unknown type: "BigIntTypeAnnotation" + at ... + +// Prettier 2.2 +const foo: bigint = 1n; +const bar: baz<1n> = 1n; +``` + +#### Treat more simple types as non-breaking in generic type annotations ([#9543](https://github.com/prettier/prettier/pull/9543) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; + +// Prettier 2.1 +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo< + symbol +> = a; +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo< + "STRING" +> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo< + 0 +> = a; + +// Prettier 2.2 (typescript and flow parser) +const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo = a +const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a; +const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a; +``` + +#### Fix missing parentheses around `prettier-ignore`d type assertions ([#9553](https://github.com/prettier/prettier/pull/9553) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +transform( + // prettier-ignore + (pointTransformer: (Point => Point)) +); + +// Prettier 2.1 +transform( + // prettier-ignore + pointTransformer: (Point => Point) +); + +// Prettier 2.2 +transform( + // prettier-ignore + (pointTransformer: (Point => Point)) +); +``` + +#### Improve comment types detection ([#9563](https://github.com/prettier/prettier/pull/9563) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +foo/*::*/(baz); +class Foo { + bar( data: Array) {} +} + +// Prettier 2.1 +foo/*:: */(baz); +class Foo { + bar(data: Array/*:: */) {} +} + +// Prettier 2.2 +foo/*:: */(baz); +class Foo { + bar(data: Array) {} +} +``` + +### Less + +#### Fix comments in value lists ([#9356](https://github.com/prettier/prettier/pull/9356) by [@thorn0](https://github.com/thorn0)) + + +```less +// Input +@test-space-separated: #aaaaaa // Start with A + #bbbbbb // then some B + #cccccc; // and round it out with C + +// Prettier 2.1 +@test-space-separated: #aaaaaa a // Start with + #bbbbbb b // then some + #cccccc; // and round it out with C + +// Prettier 2.2 +@test-space-separated: #aaaaaa // Start with A + #bbbbbb // then some B + #cccccc; // and round it out with C +``` + +### HTML + +#### Fix crash on reading `Node.sourceSpan` ([#9368](https://github.com/prettier/prettier/pull/9368) by [@fisker](https://github.com/fisker)) + + +```html + +a-b- + + +TypeError: Cannot read property 'line' of undefined + at forceNextEmptyLine ... + + +a-b- +``` + +### Vue + +#### Fix inconsistent formatting for `v-for` ([#9225](https://github.com/prettier/prettier/pull/9225) by [@zweimach](https://github.com/zweimach)) + + +```vue + + + + + + + + +``` + +#### Fix inconsistent formatting for slots, support Vue 3 `script[setup]` and `style[vars]` ([#9609](https://github.com/prettier/prettier/pull/9609) by [@fisker](https://github.com/fisker)) + +- [SFC Composition API Syntax Sugar (` + + + + + + + + + + + + +``` + +### Handlebars (alpha) + +#### Fix unstable newlines after `