diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index f4e0944aca6a..45dda0bbc5f3 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,6 +5,20 @@ # See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt # Prettier bump after release +# 2.8.6 +0461cdd8149f0bb9bb95dfac5faed75b47f77689 +# 2.8.5 +c1808e86a3c7c2c8f43093f99e78fce3b6d0a97d +# 2.8.4 +f3b23ab63c9387329dc1993e1d0aa71583d67a0b +# 2.8.3 +9e9f8ec13f0420a4825fdba85d79ddeaaef1e00c +# 2.8.2 +b9c3cd4c7016dfb1bb3539c5b3db15fdd54b9f6f +# 2.8.1 +b87de09bcf9a523fe3da31394ba0e6f5d107cf3e +# 2.8.0 +4049e49fe2a939facd6f46be338a3be9c1c0489e # 2.7.1 1f9baef429df2516ff8eb835fd8c020b5e854a5f # 2.7.0 diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 8c834ef3c168..dde56b359f9e 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.7.1** +**Prettier 2.8.6** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 5ad85c7f69f0..e3aba155c528 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.7.1 +- Prettier Version: 2.8.6 - Running Prettier via: - Runtime: - Operating System: diff --git a/.github/no-response.yml b/.github/no-response.yml deleted file mode 100644 index c60869464562..000000000000 --- a/.github/no-response.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Configuration for probot-no-response - https://github.com/probot/no-response - -daysUntilClose: 14 -responseRequiredLabel: "status:awaiting response" -closeComment: > - This issue has been automatically closed because there has been no response - to our request for more information from the original author. With only the - information that is currently in the issue, we don't have enough information - to take action. Please reach out if you have or find the answers we need so - that we can investigate further. diff --git a/.github/renovate.json5 b/.github/renovate.json5 index f3dd88ef60b6..74f9dfb2f5c8 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -14,6 +14,10 @@ excludePackageNames: ["@babel/parser"], groupName: "babel", }, + { + matchPackagePrefixes: ["@typescript-eslint/"], + groupName: "typescript-eslint", + }, { branchPrefix: "renovate/website/", matchPaths: ["website/package.json"], diff --git a/.github/workflows/bundler-friendly.yml b/.github/workflows/bundler-friendly.yml index 063b2cfa7973..b9bd035a85d6 100644 --- a/.github/workflows/bundler-friendly.yml +++ b/.github/workflows/bundler-friendly.yml @@ -2,8 +2,8 @@ name: Bundler_Friendly on: schedule: - # “At 00:00 on Sunday.” https://crontab.guru/#0%C2%A00%C2%A0*%C2%A0*%C2%A00 - - cron: "0 0 * * 0" + # “At 00:00 on Sunday.” https://crontab.guru/#0_0_*_*_SUN + - cron: "0 0 * * SUN" pull_request: paths: - "scripts/tools/bundle-test/**" @@ -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 52c72dc8aab4..6bfe936af3db 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -2,8 +2,8 @@ name: Dev_Package_Test on: schedule: - # “At 00:00 on Sunday.” https://crontab.guru/#0%C2%A00%C2%A0*%C2%A0*%C2%A00 - - cron: "0 0 * * 0" + # “At 00:00 on Sunday.” https://crontab.guru/#0_0_*_*_SUN + - cron: "0 0 * * SUN" pull_request: paths: - "package.json" @@ -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 5207ea059c61..7c37a1a5a757 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -2,10 +2,12 @@ name: "Lock" on: schedule: + # “At 00:00.” https://crontab.guru/#0_0_*_*_* - cron: "0 0 * * *" 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 new file mode 100644 index 000000000000..e2ce85eaccdd --- /dev/null +++ b/.github/workflows/no-response.yml @@ -0,0 +1,31 @@ +name: No Response + +# Both `issue_comment` and `scheduled` event types are required for this Action +# to work properly. +on: + issue_comment: + types: + - created + schedule: + # “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 + with: + token: ${{ github.token }} + daysUntilClose: 14 + responseRequiredLabel: "status:awaiting response" + closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. With only the + information that is currently in the issue, we don't have enough information + to take action. Please reach out if you have or find the answers we need so + that we can investigate further. diff --git a/.gitignore b/.gitignore index a4b256cdee98..ba3f64a175af 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,6 @@ package-lock.json .pnp.* .nyc_output .devcontainer +.node-version # When installing software on gitpod.io, `core.*` files are generated /core.* diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f0c74018eb7..e07428f2f914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,768 @@ +# 2.8.6 + +[diff](https://github.com/prettier/prettier/compare/2.8.5...2.8.6) + +#### Allow decorators on private members and class expressions ([#14548](https://github.com/prettier/prettier/pull/14548) by [@fisker](https://github.com/fisker)) + + +```ts +// Input +class A { + @decorator() + #privateMethod () {} +} + +// Prettier 2.8.5 +SyntaxError: Decorators are not valid here. (2:3) + 1 | class A { +> 2 | @decorator() + | ^^^^^^^^^^^^ + 3 | #privateMethod () {} + 4 | } + +// Prettier 2.8.6 +class A { + @decorator() + #privateMethod() {} +} +``` + +# 2.8.5 + +[diff](https://github.com/prettier/prettier/compare/2.8.4...2.8.5) + +#### Support TypeScript 5.0 ([#14391](https://github.com/prettier/prettier/pull/14391) by [@fisker](https://github.com/fisker), [#13819](https://github.com/prettier/prettier/pull/13819) by [@fisker](https://github.com/fisker), [@sosukesuzuki](https://github.com/sosukesuzuki)) + +TypeScript 5.0 introduces two new syntactic features: + +- `const` modifiers for type parameters +- `export type *` declarations + +#### Add missing parentheses for decorator ([#14393](https://github.com/prettier/prettier/pull/14393) by [@fisker](https://github.com/fisker)) + + +```jsx +// Input +class Person { + @(myDecoratorArray[0]) + greet() {} +} + +// Prettier 2.8.4 +class Person { + @myDecoratorArray[0] + greet() {} +} + +// Prettier 2.8.5 +class Person { + @(myDecoratorArray[0]) + greet() {} +} +``` + +#### Add parentheses for `TypeofTypeAnnotation` to improve readability ([#14458](https://github.com/prettier/prettier/pull/14458) by [@fisker](https://github.com/fisker)) + + +```tsx +// Input +type A = (typeof node.children)[]; + +// Prettier 2.8.4 +type A = typeof node.children[]; + +// Prettier 2.8.5 +type A = (typeof node.children)[]; +``` + +#### Support `max_line_length=off` when parsing `.editorconfig` ([#14516](https://github.com/prettier/prettier/pull/14516) by [@josephfrazier](https://github.com/josephfrazier)) + +If an .editorconfig file is in your project and it sets `max_line_length=off` for the file you're formatting, +it will be interpreted as a `printWidth` of `Infinity` rather than being ignored +(which previously resulted in the default `printWidth` of 80 being applied, if not overridden by Prettier-specific configuration). + + +```html + +
+ + +
; + + +
; +``` + +# 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) + +#### Allow self-closing tags on custom elements ([#14170](https://github.com/prettier/prettier/pull/14170) by [@fisker](https://github.com/fisker)) + +See [Angular v15.1.0 release note](https://github.com/angular/angular/releases/tag/15.1.0) for details. + + +```html +// Input + + +// Prettier 2.8.2 +SyntaxError: Only void and foreign elements can be self closed "app-test" (1:1) +> 1 | + | ^^^^^^^^^ + 2 | + +// Prettier 2.8.3 + +``` + +# 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) + +#### Fix SCSS map in arguments ([#9184](https://github.com/prettier/prettier/pull/9184) by [@agamkrbit](https://github.com/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 2.8.0 +$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 2.8.1 +$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 +); +``` + +#### Support auto accessors syntax ([#13919](https://github.com/prettier/prettier/pull/13919) by [@sosukesuzuki](https://github.com/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; +} +``` + +# 2.8.0 + +[diff](https://github.com/prettier/prettier/compare/2.7.1...2.8.0) + +🔗 [Release Notes](https://prettier.io/blog/2022/11/23/2.8.0.html) + # 2.7.1 [diff](https://github.com/prettier/prettier/compare/2.7.0...2.7.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/angular/13100.md b/changelog_unreleased/angular/13100.md deleted file mode 100644 index 06c2e3c301b9..000000000000 --- a/changelog_unreleased/angular/13100.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Insert spaces in pipe (#13100 by @sosukesuzuki) - - -```html - - - - - - - - -``` diff --git a/changelog_unreleased/api/10183.md b/changelog_unreleased/api/10183.md deleted file mode 100644 index 9807e453ecc4..000000000000 --- a/changelog_unreleased/api/10183.md +++ /dev/null @@ -1,3 +0,0 @@ -#### "Doc Explorer" mode for the Playground (#10183 by @thorn0) - -Switch the `parser` option to the special `doc-explorer` value to play with Prettier's intermediate representation and see how it's printed with different options. diff --git a/changelog_unreleased/api/12362.md b/changelog_unreleased/api/12362.md deleted file mode 100644 index 3bd000439297..000000000000 --- a/changelog_unreleased/api/12362.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Fix doc printer issue when using `ifBreak` inside `group` (#12362 by @fisker) - - -```jsx -// Input -// |80 -for (const number of [123_123_123, 123_123_123, 123_123_123, 123_123_123, 12]) { -} - -// Prettier stable -for (const number of [ - 123_123_123, 123_123_123, 123_123_123, 123_123_123, 12, -]) { -} - -// Prettier main -for (const number of [123_123_123, 123_123_123, 123_123_123, 123_123_123, 12]) { -} -``` diff --git a/changelog_unreleased/api/13227.md b/changelog_unreleased/api/13227.md deleted file mode 100644 index 73b1fa5dc25b..000000000000 --- a/changelog_unreleased/api/13227.md +++ /dev/null @@ -1,3 +0,0 @@ -#### "Rethrow embed errors" checkbox on the Playground (#13227 by @thorn0) - -Previously, the behavior of the Playground was confusingly inconsistent with the local behavior of Prettier in that it surfaced parsing errors in embedded languages for debug purposes. Now this behavior is controlled by a checkbox and disabled by default. diff --git a/changelog_unreleased/cli/13019.md b/changelog_unreleased/cli/13019.md deleted file mode 100644 index bb4f81b2bab8..000000000000 --- a/changelog_unreleased/cli/13019.md +++ /dev/null @@ -1,9 +0,0 @@ -#### Add `--cache-location` option (#13019 by @sosukesuzuki) - -Path to the cache file location used by `--cache` flag. If you don't explicit `--cache-location`, Prettier saves cache file at `./node_modules/.cache/prettier/.prettier-cache`. - -If a file path is passed, that file is used as the cache file. - -```bash -prettier --write --cache --cache-location=my_cache_file src -``` diff --git a/changelog_unreleased/cli/13081.md b/changelog_unreleased/cli/13081.md deleted file mode 100644 index 67acee0284be..000000000000 --- a/changelog_unreleased/cli/13081.md +++ /dev/null @@ -1,3 +0,0 @@ -#### Infer parser for `.lintstagedrc` (#13081 by @OrRosenblatt) - -A `.lintstagedrc` file (without extension) is handled using `json` and `yaml` parsers. diff --git a/changelog_unreleased/css/14208.md b/changelog_unreleased/css/14208.md new file mode 100644 index 000000000000..a2b97cf37f86 --- /dev/null +++ b/changelog_unreleased/css/14208.md @@ -0,0 +1,23 @@ +#### Fix line break in CSS declaration with comma (#14208 by @mvorisek) + + +```css +// Input +.myclass { + box-shadow: + inset 0 0 10px #555, + 0 0 20px black; +} + +// Prettier stable +.myclass { + box-shadow: inset 0 0 10px #555, 0 0 20px black; +} + +// Prettier main +.myclass { + box-shadow: + inset 0 0 10px #555, + 0 0 20px black; +} +``` diff --git a/changelog_unreleased/javascript/13054.md b/changelog_unreleased/javascript/13054.md deleted file mode 100644 index 6fddc71bebe0..000000000000 --- a/changelog_unreleased/javascript/13054.md +++ /dev/null @@ -1,28 +0,0 @@ -#### Fix docblock parsing (#13054 by @fisker) - - -```jsx -// With `--insert-pragma` flag - -// Input -/* comment */ -foo() - -// Prettier stable -/** - * /* comment - * - * @format - */ - -foo(); - -// Prettier main -/** - * comment - * - * @format - */ - -foo(); -``` diff --git a/changelog_unreleased/javascript/13173.md b/changelog_unreleased/javascript/13173.md deleted file mode 100644 index 505e8b71af77..000000000000 --- a/changelog_unreleased/javascript/13173.md +++ /dev/null @@ -1,20 +0,0 @@ -#### Fix range format for function bodies (#13173 by @thorn0) - - -```jsx -// Input -let fn = (() => { - return; // -//^^^^^^^^^^ - range -}); - -// Prettier stable -let fn = (() => { - return; // -};); - -// Prettier main -let fn = (() => { - return; // -}); -``` diff --git a/cspell.json b/cspell.json index 4475099a8a8a..2a89cde4cf50 100644 --- a/cspell.json +++ b/cspell.json @@ -14,6 +14,7 @@ "arrayify", "Artem", "Ascher", + "astro", "atrule", "atrules", "atword", @@ -32,6 +33,7 @@ "Bekkelund", "Bento", "bfnrt", + "bgsound", "binaryish", "bindon", "bitshift", @@ -213,6 +215,7 @@ "Monteiro", "Morrell", "motiz", + "Motoko", "mousedown", "mouseup", "mprettier", @@ -223,6 +226,7 @@ "neoclide", "neoformat", "neovim", + "nginx", "nnoremap", "nocheck", "nonenumerable", @@ -335,6 +339,7 @@ "Tradeshift", "Transloadit", "trippable", + "tsbuild", "tsep", "TSES", "TSJS", @@ -369,6 +374,7 @@ "webstorm", "Weixin", "whitespaces", + "withastro", "wxss", "xdescribe", "xtest", diff --git a/docs/browser.md b/docs/browser.md index cab603285900..3300c833783b 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 - - + + - + +