diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 63ffe65ce..b3358e557 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,6 +5,8 @@ # See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt # Prettier bump after release +# 2.8.4 +f3b23ab63c9387329dc1993e1d0aa71583d67a0b # 2.8.3 9e9f8ec13f0420a4825fdba85d79ddeaaef1e00c # 2.8.2 diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 8e49b6b6f..f2a21f21f 100644 --- a/.github/ISSUE_TEMPLATE/formatting.md +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you: --> -**Prettier 2.8.3** +**Prettier 2.8.4** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 239aba6e9..58f004f6c 100644 --- a/.github/ISSUE_TEMPLATE/integration.md +++ b/.github/ISSUE_TEMPLATE/integration.md @@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE: **Environments:** -- Prettier Version: 2.8.3 +- Prettier Version: 2.8.4 - Running Prettier via: - Runtime: - Operating System: diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a47b3eff..92259f95c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,126 @@ +# 2.8.4 + +[diff](https://github.com/prettier/prettier/compare/2.8.3...2.8.4) + +#### Fix leading comments in mapped types with `readonly` ([#13427](https://github.com/prettier/prettier/pull/13427) by [@thorn0](https://github.com/thorn0), [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```tsx +// Input +type Type = { + // comment + readonly [key in Foo]; +}; + +// Prettier 2.8.3 +type Type = { + readonly // comment + [key in Foo]; +}; + +// Prettier 2.8.4 +type Type = { + // comment + readonly [key in Foo]; +}; +``` + +#### Group params in opening block statements ([#14067](https://github.com/prettier/prettier/pull/14067) by [@jamescdavis](https://github.com/jamescdavis)) + +This is a follow-up to #13930 to establish wrapping consistency between opening block statements and else blocks by +grouping params in opening blocks. This causes params to break to a new line together and not be split across lines +unless the length of params exceeds the print width. This also updates the else block wrapping to behave exactly the +same as opening blocks. + + +```hbs +{{! Input }} +{{#block param param param param param param param param param param as |blockParam|}} + Hello +{{else block param param param param param param param param param param as |blockParam|}} + There +{{/block}} + +{{! Prettier 2.8.3 }} +{{#block + param + param + param + param + param + param + param + param + param + param + as |blockParam| +}} + Hello +{{else block param +param +param +param +param +param +param +param +param +param}} + There +{{/block}} + +{{! Prettier 2.8.4 }} +{{#block + param param param param param param param param param param + as |blockParam| +}} + Hello +{{else block + param param param param param param param param param param + as |blockParam| +}} + There +{{/block}} +``` + +#### Ignore files in `.sl/` ([#14206](https://github.com/prettier/prettier/pull/14206) by [@bolinfest](https://github.com/bolinfest)) + +In [Sapling SCM](https://sapling-scm.com/), `.sl/` is the folder where it stores its state, analogous to `.git/` in Git. It should be ignored in Prettier like the other SCM folders. + +#### Recognize `@satisfies` in Closure-style type casts ([#14262](https://github.com/prettier/prettier/pull/14262) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +const a = /** @satisfies {Record} */ ({hello: 1337}); +const b = /** @type {Record} */ ({hello: 1337}); + +// Prettier 2.8.3 +const a = /** @satisfies {Record} */ { hello: 1337 }; +const b = /** @type {Record} */ ({ hello: 1337 }); + +// Prettier 2.8.4 +const a = /** @satisfies {Record} */ ({hello: 1337}); +const b = /** @type {Record} */ ({hello: 1337}); +``` + +#### Fix parens in inferred function return types with `extends` ([#14279](https://github.com/prettier/prettier/pull/14279) by [@fisker](https://github.com/fisker)) + + +```ts +// Input +type Foo = T extends ((a) => a is infer R extends string) ? R : never; + +// Prettier 2.8.3 (First format) +type Foo = T extends (a) => a is infer R extends string ? R : never; + +// Prettier 2.8.3 (Second format) +SyntaxError: '?' expected. + +// Prettier 2.8.4 +type Foo = T extends ((a) => a is infer R extends string) ? R : never; +``` + # 2.8.3 [diff](https://github.com/prettier/prettier/compare/2.8.2...2.8.3) diff --git a/changelog_unreleased/handlebars/14067.md b/changelog_unreleased/handlebars/14067.md deleted file mode 100644 index 6edfdfc94..000000000 --- a/changelog_unreleased/handlebars/14067.md +++ /dev/null @@ -1,57 +0,0 @@ -#### Group params in opening block statements (#14067 by @jamescdavis) - -This is a follow-up to #13930 to establish wrapping consistency between opening block statements and else blocks by -grouping params in opening blocks. This causes params to break to a new line together and not be split across lines -unless the length of params exceeds the print width. This also updates the else block wrapping to behave exactly the -same as opening blocks. - - -```hbs -{{! Input }} -{{#block param param param param param param param param param param as |blockParam|}} - Hello -{{else block param param param param param param param param param param as |blockParam|}} - There -{{/block}} - -{{! Prettier stable }} -{{#block - param - param - param - param - param - param - param - param - param - param - as |blockParam| -}} - Hello -{{else block param -param -param -param -param -param -param -param -param -param}} - There -{{/block}} - -{{! Prettier main }} -{{#block - param param param param param param param param param param - as |blockParam| -}} - Hello -{{else block - param param param param param param param param param param - as |blockParam| -}} - There -{{/block}} -``` diff --git a/docs/browser.md b/docs/browser.md index d01d4e16e..e8221b5bb 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -18,7 +18,7 @@ Required options: - **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use. -- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in +- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option. @@ -29,8 +29,8 @@ See below for examples. ### Global ```html - - + + - + +