diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index cc4b5557cbd3..ec125b47bd42 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.1 +b87de09bcf9a523fe3da31394ba0e6f5d107cf3e # 2.8.0 4049e49fe2a939facd6f46be338a3be9c1c0489e # 2.7.1 diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 4299ace0e232..340fab2a4f0e 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.1** +**Prettier 2.8.2** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index a7477dbe920d..b397119d2a0a 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.1 +- Prettier Version: 2.8.2 - Running Prettier via: - Runtime: - Operating System: diff --git a/.github/workflows/bundler-friendly.yml b/.github/workflows/bundler-friendly.yml index c7d98ac40bf4..b9bd035a85d6 100644 --- a/.github/workflows/bundler-friendly.yml +++ b/.github/workflows/bundler-friendly.yml @@ -12,6 +12,7 @@ on: jobs: build: + if: github.event_name != 'schedule' || github.repository == 'prettier/prettier' name: Build runs-on: ubuntu-latest steps: @@ -36,6 +37,7 @@ jobs: path: dist webpack: + if: github.event_name != 'schedule' || github.repository == 'prettier/prettier' name: Bundle Prettier with webpack runs-on: ubuntu-latest needs: [build] diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index cf44ac4fdc39..6bfe936af3db 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -14,6 +14,7 @@ on: jobs: test: + if: github.event_name != 'schedule' || github.repository == 'prettier/prettier' timeout-minutes: 60 strategy: fail-fast: false diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 68524e76ef1b..7c37a1a5a757 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -7,6 +7,7 @@ on: jobs: lock: + if: github.event_name != 'schedule' || github.repository == 'prettier/prettier' runs-on: ubuntu-latest steps: - uses: dessant/lock-threads@v3 diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml index 5981ff4b70ef..e2ce85eaccdd 100644 --- a/.github/workflows/no-response.yml +++ b/.github/workflows/no-response.yml @@ -7,14 +7,15 @@ on: types: - created schedule: - # “At minute 0.” https://crontab.guru/#0_*_*_*_* - - cron: "0 * * * *" + # “At 00:00.” https://crontab.guru/#0_0_*_*_* + - cron: "0 0 * * *" permissions: issues: write jobs: no-response: + if: github.event_name != 'schedule' || github.repository == 'prettier/prettier' runs-on: ubuntu-latest steps: - uses: lee-dohm/no-response@v0.5.0 diff --git a/.node-version b/.node-version new file mode 100644 index 000000000000..b460d6f2dea9 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +18.12.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b9bd9142fa7..e87fe40b2b10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,464 @@ +# 2.8.2 + +[diff](https://github.com/prettier/prettier/compare/2.8.1...2.8.2) + +#### Don't lowercase link references ([#13155](https://github.com/prettier/prettier/pull/13155) by [@DerekNonGeneric](https://github.com/DerekNonGeneric) & [@fisker](https://github.com/fisker)) + + +```markdown + +We now don't strictly follow the release notes format suggested by [Keep a Changelog]. + +[Keep a Changelog]: https://example.com/ + + +We now don't strictly follow the release notes format suggested by [Keep a Changelog]. + +[keep a changelog]: https://example.com/ + + + + +``` + +#### Preserve self-closing tags ([#13691](https://github.com/prettier/prettier/pull/13691) by [@dcyriller](https://github.com/dcyriller)) + + +```hbs +{{! Input }} +
+
+ + + + + + + +{{! Prettier 2.8.1 }} +
+
+ + + + + + + +{{! Prettier 2.8.2 }} +
+
+ + + + + + +``` + +#### Allow custom "else if"-like blocks with block params ([#13930](https://github.com/prettier/prettier/pull/13930) by [@jamescdavis](https://github.com/jamescdavis)) + +#13507 added support for custom block keywords used with `else`, but failed to allow block params. This updates printer-glimmer to allow block params with custom "else if"-like blocks. + + +```hbs +{{! Input }} +{#when isAtWork as |work|}} + Ship that + {{work}}! +{{else when isReading as |book|}} + You can finish + {{book}} + eventually... +{{else}} + Go to bed! +{{/when}} + +{{! Prettier 2.8.1 }} +{{#when isAtWork as |work|}} + Ship that + {{work}}! +{{else when isReading}} + You can finish + {{book}} + eventually... +{{else}} + Go to bed! +{{/when}} + +{{! Prettier 2.8.2 }} +{#when isAtWork as |work|}} + Ship that + {{work}}! +{{else when isReading as |book|}} + You can finish + {{book}} + eventually... +{{else}} + Go to bed! +{{/when}} +``` + +#### Preserve empty lines between nested SCSS maps ([#13931](https://github.com/prettier/prettier/pull/13931) by [@jneander](https://github.com/jneander)) + + +```scss +/* Input */ +$map: ( + 'one': ( + 'key': 'value', + ), + + 'two': ( + 'key': 'value', + ), +) + +/* Prettier 2.8.1 */ +$map: ( + 'one': ( + 'key': 'value', + ), + 'two': ( + 'key': 'value', + ), +) + +/* Prettier 2.8.2 */ +$map: ( + 'one': ( + 'key': 'value', + ), + + 'two': ( + 'key': 'value', + ), +) +``` + +#### Fix missing parentheses when an expression statement starts with `let[` ([#14000](https://github.com/prettier/prettier/pull/14000), [#14044](https://github.com/prettier/prettier/pull/14044) by [@fisker](https://github.com/fisker), [@thorn0](https://github.com/thorn0)) + + +```jsx +// Input +(let[0] = 2); + +// Prettier 2.8.1 +let[0] = 2; + +// Prettier 2.8.1 (second format) +SyntaxError: Unexpected token (1:5) +> 1 | let[0] = 2; + | ^ + 2 | + +// Prettier 2.8.2 +(let)[0] = 2; +``` + +#### Fix semicolon duplicated at the end of LESS file ([#14007](https://github.com/prettier/prettier/pull/14007) by [@mvorisek](https://github.com/mvorisek)) + + +```less +// Input +@variable: { + field: something; +}; + +// Prettier 2.8.1 +@variable: { + field: something; +}; ; + +// Prettier 2.8.2 +@variable: { + field: something; +}; +``` + +#### Fix no space after unary minus when followed by opening parenthesis in LESS ([#14008](https://github.com/prettier/prettier/pull/14008) by [@mvorisek](https://github.com/mvorisek)) + + +```less +// Input +.unary_minus_single { + margin: -(@a); +} + +.unary_minus_multi { + margin: 0 -(@a); +} + +.binary_minus { + margin: 0 - (@a); +} + +// Prettier 2.8.1 +.unary_minus_single { + margin: - (@a); +} + +.unary_minus_multi { + margin: 0 - (@a); +} + +.binary_minus { + margin: 0 - (@a); +} + +// Prettier 2.8.2 +.unary_minus_single { + margin: -(@a); +} + +.unary_minus_multi { + margin: 0 -(@a); +} + +.binary_minus { + margin: 0 - (@a); +} +``` + +#### Do not change case of property name if inside a variable declaration in LESS ([#14034](https://github.com/prettier/prettier/pull/14034) by [@mvorisek](https://github.com/mvorisek)) + + +```less +// Input +@var: { + preserveCase: 0; +}; + +// Prettier 2.8.1 +@var: { + preservecase: 0; +}; + +// Prettier 2.8.2 +@var: { + preserveCase: 0; +}; +``` + +#### Fix formatting for auto-accessors with comments ([#14038](https://github.com/prettier/prettier/pull/14038) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +class A { + @dec() + // comment + accessor b; +} + +// Prettier 2.8.1 +class A { + @dec() + accessor // comment + b; +} + +// Prettier 2.8.1 (second format) +class A { + @dec() + accessor; // comment + b; +} + +// Prettier 2.8.2 +class A { + @dec() + // comment + accessor b; +} +``` + +#### Add parentheses for TSTypeQuery to improve readability ([#14042](https://github.com/prettier/prettier/pull/14042) by [@onishi-kohei](https://github.com/onishi-kohei)) + + +```tsx +// Input +a as (typeof node.children)[number] +a as (typeof node.children)[] +a as ((typeof node.children)[number])[] + +// Prettier 2.8.1 +a as typeof node.children[number]; +a as typeof node.children[]; +a as typeof node.children[number][]; + +// Prettier 2.8.2 +a as (typeof node.children)[number]; +a as (typeof node.children)[]; +a as (typeof node.children)[number][]; +``` + +#### Fix displacing of comments in default switch case ([#14047](https://github.com/prettier/prettier/pull/14047) by [@thorn0](https://github.com/thorn0)) + +It was a regression in Prettier 2.6.0. + + +```jsx +// Input +switch (state) { + default: + result = state; // no change + break; +} + +// Prettier 2.8.1 +switch (state) { + default: // no change + result = state; + break; +} + +// Prettier 2.8.2 +switch (state) { + default: + result = state; // no change + break; +} +``` + +#### Support type annotations on auto accessors via `babel-ts` ([#14049](https://github.com/prettier/prettier/pull/14049) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +[The bug that `@babel/parser` cannot parse auto accessors with type annotations](https://github.com/babel/babel/issues/15205) has been fixed. So we now support it via `babel-ts` parser. + + +```tsx +class Foo { + accessor prop: number; +} +``` + +#### Fix formatting of empty type parameters ([#14073](https://github.com/prettier/prettier/pull/14073) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +const foo: bar = () => baz; + +// Prettier 2.8.1 +Error: Comment "comment" was not printed. Please report this error! + +// Prettier 2.8.2 +const foo: bar = () => baz; +``` + +#### Add parentheses to head of `ExpressionStatement` instead of the whole statement ([#14077](https://github.com/prettier/prettier/pull/14077) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +({}).toString.call(foo) === "[object Array]" + ? foo.forEach(iterateArray) + : iterateObject(foo); + +// Prettier 2.8.1 +({}.toString.call(foo) === "[object Array]" + ? foo.forEach(iterateArray) + : iterateObject(foo)); + +// Prettier 2.8.2 +({}).toString.call(foo.forEach) === "[object Array]" + ? foo.forEach(iterateArray) + : iterateObject(foo); +``` + +#### Fix comments after directive ([#14081](https://github.com/prettier/prettier/pull/14081) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +"use strict" /* comment */; + +// Prettier 2.8.1 (with other js parsers except `babel`) +Error: Comment "comment" was not printed. Please report this error! + +// Prettier 2.8.2 + +``` + +#### Fix formatting for comments inside JSX attribute ([#14082](https://github.com/prettier/prettier/pull/14082) with by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +function MyFunctionComponent() { + +} + +// Prettier 2.8.1 +Error: Comment "old" was not printed. Please report this error! + +// Prettier 2.8.2 +function MyFunctionComponent() { + ; +} +``` + +#### Quote numeric keys for json-stringify parser ([#14083](https://github.com/prettier/prettier/pull/14083) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +{0: 'value'} + +// Prettier 2.8.1 +{ + 0: "value" +} + +// Prettier 2.8.2 +{ + "0": "value" +} +``` + +#### Fix removing commas from function arguments in maps ([#14089](https://github.com/prettier/prettier/pull/14089) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```scss +/* Input */ +$foo: map-fn( + ( + "#{prop}": inner-fn($first, $second), + ) +); + +/* Prettier 2.8.1 */ +$foo: map-fn(("#{prop}": inner-fn($first $second))); + +/* Prettier 2.8.2 */ +$foo: map-fn( + ( + "#{prop}": inner-fn($first, $second), + ) +); + +``` + +#### Do not insert space in LESS property access ([#14103](https://github.com/prettier/prettier/pull/14103) by [@fisker](https://github.com/fisker)) + + +```less +// Input +a { + color: @colors[@white]; +} + +// Prettier 2.8.1 +a { + color: @colors[ @white]; +} + +// Prettier 2.8.2 + +``` + # 2.8.1 [diff](https://github.com/prettier/prettier/compare/2.8.0...2.8.1) diff --git a/README.md b/README.md index 943299e12f9d..4076b3ad5fd3 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,11 @@

- Github Actions Build Status + Github Actions Build Status - Github Actions Build Status + Github Actions Build Status - Github Actions Build Status + Github Actions Build Status Codecov Coverage Status diff --git a/changelog_unreleased/flow/14073.md b/changelog_unreleased/flow/14073.md new file mode 100644 index 000000000000..8e6f005711c9 --- /dev/null +++ b/changelog_unreleased/flow/14073.md @@ -0,0 +1,13 @@ +#### Fix formatting of empty type parameters (#14073 by @fisker) + + +```jsx +// Input +const foo: bar = () => baz; + +// Prettier stable +Error: Comment "comment" was not printed. Please report this error! + +// Prettier main +const foo: bar = () => baz; +``` diff --git a/changelog_unreleased/handlebars/13691.md b/changelog_unreleased/handlebars/13691.md new file mode 100644 index 000000000000..ab836c2d16dc --- /dev/null +++ b/changelog_unreleased/handlebars/13691.md @@ -0,0 +1,34 @@ +#### Preserve self-closing tags (#13691 by @dcyriller) + + +```hbs +{{! Input }} +

+
+ + + + + + + +{{! Prettier stable }} +
+
+ + + + + + + +{{! Prettier main }} +
+
+ + + + + + +``` diff --git a/changelog_unreleased/handlebars/13930.md b/changelog_unreleased/handlebars/13930.md new file mode 100644 index 000000000000..6e824a32e02c --- /dev/null +++ b/changelog_unreleased/handlebars/13930.md @@ -0,0 +1,42 @@ +#### Allow custom "else if"-like blocks with block params (#13930 by @jamescdavis) + +#13507 added support for custom block keywords used with `else`, but failed to allow block params. This updates printer-glimmer to allow block params with custom "else if"-like blocks. + + +```hbs +{{! Input }} +{#when isAtWork as |work|}} + Ship that + {{work}}! +{{else when isReading as |book|}} + You can finish + {{book}} + eventually... +{{else}} + Go to bed! +{{/when}} + +{{! Prettier stable }} +{{#when isAtWork as |work|}} + Ship that + {{work}}! +{{else when isReading}} + You can finish + {{book}} + eventually... +{{else}} + Go to bed! +{{/when}} + +{{! Prettier main }} +{#when isAtWork as |work|}} + Ship that + {{work}}! +{{else when isReading as |book|}} + You can finish + {{book}} + eventually... +{{else}} + Go to bed! +{{/when}} +``` diff --git a/changelog_unreleased/javascript/14000.md b/changelog_unreleased/javascript/14000.md new file mode 100644 index 000000000000..914800969a96 --- /dev/null +++ b/changelog_unreleased/javascript/14000.md @@ -0,0 +1,19 @@ +#### Fix missing parentheses when an expression statement starts with `let[` (#14000, #14044 by @fisker, @thorn0) + + +```jsx +// Input +(let[0] = 2); + +// Prettier stable +let[0] = 2; + +// Prettier stable (second format) +SyntaxError: Unexpected token (1:5) +> 1 | let[0] = 2; + | ^ + 2 | + +// Prettier main +(let)[0] = 2; +``` diff --git a/changelog_unreleased/javascript/14038.md b/changelog_unreleased/javascript/14038.md new file mode 100644 index 000000000000..b52a5aa34d96 --- /dev/null +++ b/changelog_unreleased/javascript/14038.md @@ -0,0 +1,32 @@ +#### Fix formatting for auto-accessors with comments (#14038 by @fisker) + + +```jsx +// Input +class A { + @dec() + // comment + accessor b; +} + +// Prettier stable +class A { + @dec() + accessor // comment + b; +} + +// Prettier stable (second format) +class A { + @dec() + accessor; // comment + b; +} + +// Prettier main +class A { + @dec() + // comment + accessor b; +} +``` diff --git a/changelog_unreleased/javascript/14047.md b/changelog_unreleased/javascript/14047.md new file mode 100644 index 000000000000..9fbe380884cf --- /dev/null +++ b/changelog_unreleased/javascript/14047.md @@ -0,0 +1,27 @@ +#### Fix displacing of comments in default switch case (#14047 by @thorn0) + +It was a regression in Prettier 2.6.0. + + +```jsx +// Input +switch (state) { + default: + result = state; // no change + break; +} + +// Prettier stable +switch (state) { + default: // no change + result = state; + break; +} + +// Prettier main +switch (state) { + default: + result = state; // no change + break; +} +``` diff --git a/changelog_unreleased/javascript/14077.md b/changelog_unreleased/javascript/14077.md new file mode 100644 index 000000000000..eb48a23b8dcd --- /dev/null +++ b/changelog_unreleased/javascript/14077.md @@ -0,0 +1,19 @@ +#### Add parentheses to head of `ExpressionStatement` instead of the whole statement (#14077 by @fisker) + + +```jsx +// Input +({}).toString.call(foo) === "[object Array]" + ? foo.forEach(iterateArray) + : iterateObject(foo); + +// Prettier stable +({}.toString.call(foo) === "[object Array]" + ? foo.forEach(iterateArray) + : iterateObject(foo)); + +// Prettier main +({}).toString.call(foo.forEach) === "[object Array]" + ? foo.forEach(iterateArray) + : iterateObject(foo); +``` diff --git a/changelog_unreleased/javascript/14081.md b/changelog_unreleased/javascript/14081.md new file mode 100644 index 000000000000..92a794cbc73d --- /dev/null +++ b/changelog_unreleased/javascript/14081.md @@ -0,0 +1,13 @@ +#### Fix comments after directive (#14081 by @fisker) + + +```jsx +// Input +"use strict" /* comment */; + +// Prettier stable (with other js parsers except `babel`) +Error: Comment "comment" was not printed. Please report this error! + +// Prettier main + +``` diff --git a/changelog_unreleased/javascript/14082.md b/changelog_unreleased/javascript/14082.md new file mode 100644 index 000000000000..e56693154c5a --- /dev/null +++ b/changelog_unreleased/javascript/14082.md @@ -0,0 +1,17 @@ +#### Fix formatting for comments inside JSX attribute (#14082 with by @fisker) + + +```jsx +// Input +function MyFunctionComponent() { + +} + +// Prettier stable +Error: Comment "old" was not printed. Please report this error! + +// Prettier main +function MyFunctionComponent() { + ; +} +``` diff --git a/changelog_unreleased/json/14083.md b/changelog_unreleased/json/14083.md new file mode 100644 index 000000000000..0ab6322f8317 --- /dev/null +++ b/changelog_unreleased/json/14083.md @@ -0,0 +1,17 @@ +#### Quote numeric keys for json-stringify parser (#14083 by @fisker) + + +```jsx +// Input +{0: 'value'} + +// Prettier stable +{ + 0: "value" +} + +// Prettier main +{ + "0": "value" +} +``` diff --git a/changelog_unreleased/less/14007.md b/changelog_unreleased/less/14007.md new file mode 100644 index 000000000000..eed8b756d1d8 --- /dev/null +++ b/changelog_unreleased/less/14007.md @@ -0,0 +1,19 @@ +#### Fix semicolon duplicated at the end of LESS file (#14007 by @mvorisek) + + +```less +// Input +@variable: { + field: something; +}; + +// Prettier stable +@variable: { + field: something; +}; ; + +// Prettier main +@variable: { + field: something; +}; +``` diff --git a/changelog_unreleased/less/14008.md b/changelog_unreleased/less/14008.md new file mode 100644 index 000000000000..d21456462849 --- /dev/null +++ b/changelog_unreleased/less/14008.md @@ -0,0 +1,43 @@ +#### Fix no space after unary minus when followed by opening parenthesis in LESS (#14008 by @mvorisek) + + +```less +// Input +.unary_minus_single { + margin: -(@a); +} + +.unary_minus_multi { + margin: 0 -(@a); +} + +.binary_minus { + margin: 0 - (@a); +} + +// Prettier stable +.unary_minus_single { + margin: - (@a); +} + +.unary_minus_multi { + margin: 0 - (@a); +} + +.binary_minus { + margin: 0 - (@a); +} + +// Prettier main +.unary_minus_single { + margin: -(@a); +} + +.unary_minus_multi { + margin: 0 -(@a); +} + +.binary_minus { + margin: 0 - (@a); +} +``` diff --git a/changelog_unreleased/less/14034.md b/changelog_unreleased/less/14034.md new file mode 100644 index 000000000000..02d0d2d5f04f --- /dev/null +++ b/changelog_unreleased/less/14034.md @@ -0,0 +1,19 @@ +#### Do not change case of property name if inside a variable declaration in LESS (#14034 by @mvorisek) + + +```less +// Input +@var: { + preserveCase: 0; +}; + +// Prettier stable +@var: { + preservecase: 0; +}; + +// Prettier main +@var: { + preserveCase: 0; +}; +``` diff --git a/changelog_unreleased/less/14103.md b/changelog_unreleased/less/14103.md new file mode 100644 index 000000000000..cddb91e0f786 --- /dev/null +++ b/changelog_unreleased/less/14103.md @@ -0,0 +1,17 @@ +#### Do not insert space in LESS property access (#14103 by @fisker) + + +```less +// Input +a { + color: @colors[@white]; +} + +// Prettier stable +a { + color: @colors[ @white]; +} + +// Prettier main + +``` diff --git a/changelog_unreleased/markdown/13155.md b/changelog_unreleased/markdown/13155.md new file mode 100644 index 000000000000..ca3b25123442 --- /dev/null +++ b/changelog_unreleased/markdown/13155.md @@ -0,0 +1,20 @@ +#### Don't lowercase link references (#13155 by @DerekNonGeneric & @fisker) + + +```markdown + +We now don't strictly follow the release notes format suggested by [Keep a Changelog]. + +[Keep a Changelog]: https://example.com/ + + +We now don't strictly follow the release notes format suggested by [Keep a Changelog]. + +[keep a changelog]: https://example.com/ + + + + +``` diff --git a/changelog_unreleased/scss/13931.md b/changelog_unreleased/scss/13931.md new file mode 100644 index 000000000000..426d0c712c99 --- /dev/null +++ b/changelog_unreleased/scss/13931.md @@ -0,0 +1,36 @@ +#### Preserve empty lines between nested SCSS maps (#13931 by @jneander) + + +```scss +/* Input */ +$map: ( + 'one': ( + 'key': 'value', + ), + + 'two': ( + 'key': 'value', + ), +) + +/* Prettier stable */ +$map: ( + 'one': ( + 'key': 'value', + ), + 'two': ( + 'key': 'value', + ), +) + +/* Prettier main */ +$map: ( + 'one': ( + 'key': 'value', + ), + + 'two': ( + 'key': 'value', + ), +) +``` diff --git a/changelog_unreleased/scss/14089.md b/changelog_unreleased/scss/14089.md new file mode 100644 index 000000000000..45e6ce2841b1 --- /dev/null +++ b/changelog_unreleased/scss/14089.md @@ -0,0 +1,22 @@ +#### Fix removing commas from function arguments in maps (#14089 by @sosukesuzuki) + + +```scss +/* Input */ +$foo: map-fn( + ( + "#{prop}": inner-fn($first, $second), + ) +); + +/* Prettier stable */ +$foo: map-fn(("#{prop}": inner-fn($first $second))); + +/* Prettier main */ +$foo: map-fn( + ( + "#{prop}": inner-fn($first, $second), + ) +); + +``` diff --git a/changelog_unreleased/scss/9184.md b/changelog_unreleased/scss/9184.md deleted file mode 100644 index de3cace7df77..000000000000 --- a/changelog_unreleased/scss/9184.md +++ /dev/null @@ -1,35 +0,0 @@ -#### Fix SCSS map in arguments (#9184 by @agamkrbit) - - -```scss -// Input -$display-breakpoints: map-deep-merge( - ( - "print-only": "only print", - "screen-only": "only screen", - "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})", - ), - $display-breakpoints -); - -// Prettier stable -$display-breakpoints: map-deep-merge( - ( - "print-only": "only print", - "screen-only": "only screen", - "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, " sm - ")-1})", - ), - $display-breakpoints -); - -// Prettier main -$display-breakpoints: map-deep-merge( - ( - "print-only": "only print", - "screen-only": "only screen", - "xs-only": "only screen and (max-width: #{map-get($grid-breakpoints, "sm")-1})", - ), - $display-breakpoints -); -``` diff --git a/changelog_unreleased/typescript/13919.md b/changelog_unreleased/typescript/13919.md deleted file mode 100644 index 1b93ba0fd28a..000000000000 --- a/changelog_unreleased/typescript/13919.md +++ /dev/null @@ -1,12 +0,0 @@ -#### Support auto accessors syntax (#13919 by @sosukesuzuki) - -Support for [Auto Accessors Syntax](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#auto-accessors-in-classes) landed in TypeScript 4.9. - -(Doesn't work well with `babel-ts` parser) - - -```tsx -class Foo { - accessor foo: number = 3; -} -``` diff --git a/changelog_unreleased/typescript/14042.md b/changelog_unreleased/typescript/14042.md new file mode 100644 index 000000000000..9b37741bb68f --- /dev/null +++ b/changelog_unreleased/typescript/14042.md @@ -0,0 +1,19 @@ +#### Add parentheses for TSTypeQuery to improve readability (#14042 by @onishi-kohei) + + +```tsx +// Input +a as (typeof node.children)[number] +a as (typeof node.children)[] +a as ((typeof node.children)[number])[] + +// Prettier stable +a as typeof node.children[number]; +a as typeof node.children[]; +a as typeof node.children[number][]; + +// Prettier main +a as (typeof node.children)[number]; +a as (typeof node.children)[]; +a as (typeof node.children)[number][]; +``` diff --git a/changelog_unreleased/typescript/14049.md b/changelog_unreleased/typescript/14049.md new file mode 100644 index 000000000000..28448fa9662b --- /dev/null +++ b/changelog_unreleased/typescript/14049.md @@ -0,0 +1,10 @@ +#### Support type annotations on auto accessors via `babel-ts` (#14049 by @sosukesuzuki) + +[The bug that `@babel/parser` cannot parse auto accessors with type annotations](https://github.com/babel/babel/issues/15205) has been fixed. So we now support it via `babel-ts` parser. + + +```tsx +class Foo { + accessor prop: number; +} +``` diff --git a/docs/browser.md b/docs/browser.md index d5637b9ef6c5..1db441def451 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -20,8 +20,8 @@ Required options: - **`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 named - - `parser-*.js` in and - - `parser-*.mjs` in + - `parser-*.js` in and + - `parser-*.mjs` in You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option. @@ -32,8 +32,8 @@ See below for examples. ### Global ```html - - + + - + +