diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 202dc039e..efc9b6f8a 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.3.0** +**Prettier 2.3.1** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 8e62f1ba8..b3b8571c9 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.3.0 +- Prettier Version: 2.3.1 - Running Prettier via: - Runtime: - Operating System: diff --git a/CHANGELOG.md b/CHANGELOG.md index dcbb86702..94694bb85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,228 @@ +# 2.3.1 + +[diff](https://github.com/prettier/prettier/compare/2.3.0...2.3.1) + +#### Preserve attributes order for element node (#10958 by @dcyriller) + + +```handlebars +{{!-- Input --}} + +{{!-- Prettier stable --}} + +{{!-- Prettier main --}} + +``` + +#### Track cursor position properly when it’s at the end of the range to format (#10938 by @j-f1) + +Previously, if the cursor was at the end of the range to format, it would simply be placed back at the end of the updated range. +Now, it will be repositioned if Prettier decides to add additional code to the end of the range (such as a semicolon). + + +```jsx +// Input (<|> represents the cursor) +const someVariable = myOtherVariable<|> +// range to format: ^^^^^^^^^^^^^^^ + +// Prettier stable +const someVariable = myOtherVariable;<|> +// range to format: ^^^^^^^^^^^^^^^ + +// Prettier main +const someVariable = myOtherVariable<|>; +// range to format: ^^^^^^^^^^^^^^^ +``` + +#### Break the LHS of type alias that has complex type parameters (#10901 by @sosukesusuzki) + + +```ts +// Input +type FieldLayoutWith< + T extends string, + S extends unknown = { width: string } +> = { + type: T; + code: string; + size: S; +}; + +// Prettier stable +type FieldLayoutWith = + { + type: T; + code: string; + size: S; + }; + +// Prettier main +type FieldLayoutWith< + T extends string, + S extends unknown = { width: string } +> = { + type: T; + code: string; + size: S; +}; + +``` + +#### Break the LHS of assignments that has complex type parameters (#10916 by @sosukesuzuki) + + +```ts +// Input +const map: Map< + Function, + Map +> = new Map(); + +// Prettier stable +const map: Map> = + new Map(); + +// Prettier main +const map: Map< + Function, + Map +> = new Map(); + +``` + +#### Fix incorrectly wrapped arrow functions with return types (#10940 by @thorn0) + + +```ts +// Input +longfunctionWithCall12("bla", foo, (thing: string): complex> => { + code(); +}); + +// Prettier stable +longfunctionWithCall12("bla", foo, (thing: string): complex< + type +> => { + code(); +}); + +// Prettier main +longfunctionWithCall12( + "bla", + foo, + (thing: string): complex> => { + code(); + } +); +``` + +#### Support TypeScript 4.3 (#10945 by @sosukesuzuki) + +##### [`override` modifiers in class elements](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3/#override) + +```ts +class Foo extends { + override method() {} +} +``` + +##### [static index signatures (`[key: KeyType]: ValueType`) in classes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3/#static-index-signatures) + +```ts +class Foo { + static [key: string]: Bar; +} +``` + +##### [`get` / `set` in type declarations](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3/#separate-write-types) + +```ts +interface Foo { + set foo(value); + get foo(): string; +} +``` + +#### Avoid breaking call expressions after assignments with complex type arguments (#10949 by @sosukesuzuki) + + +```ts +// Input +const foo = call<{ + prop1: string; + prop2: string; + prop3: string; +}>(); + +// Prettier stable +const foo = + call<{ + prop1: string; + prop2: string; + prop3: string; + }>(); + +// Prettier main +const foo = call<{ + prop1: string; + prop2: string; + prop3: string; +}>(); + +``` + +#### Fix order of `override` modifiers (#10961 by @sosukesuzuki) + +```ts +// Input +class Foo extends Bar { + abstract override foo: string; +} + +// Prettier stable +class Foo extends Bar { + override abstract foo: string; +} + +// Prettier main +class Foo extends Bar { + abstract override foo: string; +} +``` + # 2.3.0 [diff](https://github.com/prettier/prettier/compare/2.2.1...2.3.0) diff --git a/docs/browser.md b/docs/browser.md index f764d5f07..cb7aee849 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -32,8 +32,8 @@ See below for examples. ### Global ```html - - + + - + +