diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index f4e0944aca6a..ec125b47bd42 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -5,6 +5,10 @@ # 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 1f9baef429df2516ff8eb835fd8c020b5e854a5f # 2.7.0 diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md index 8c834ef3c168..4299ace0e232 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.1** [Playground link](https://prettier.io/playground/#.....) ```sh diff --git a/.github/ISSUE_TEMPLATE/integration.md b/.github/ISSUE_TEMPLATE/integration.md index 5ad85c7f69f0..a7477dbe920d 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.1 - 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/workflows/bundler-friendly.yml b/.github/workflows/bundler-friendly.yml index 063b2cfa7973..c7d98ac40bf4 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/**" diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index 52c72dc8aab4..cf44ac4fdc39 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" diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 5207ea059c61..68524e76ef1b 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -2,6 +2,7 @@ name: "Lock" on: schedule: + # “At 00:00.” https://crontab.guru/#0_0_*_*_* - cron: "0 0 * * *" jobs: diff --git a/.github/workflows/no-response.yml b/.github/workflows/no-response.yml new file mode 100644 index 000000000000..5981ff4b70ef --- /dev/null +++ b/.github/workflows/no-response.yml @@ -0,0 +1,30 @@ +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 minute 0.” https://crontab.guru/#0_*_*_*_* + - cron: "0 * * * *" + +permissions: + issues: write + +jobs: + no-response: + 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/.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 2f0c74018eb7..5b9bd9142fa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,62 @@ +# 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/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/13577.md b/changelog_unreleased/css/13577.md deleted file mode 100644 index e19fe8491181..000000000000 --- a/changelog_unreleased/css/13577.md +++ /dev/null @@ -1,32 +0,0 @@ -#### Fix formatting of long `:is`, `:where`, and `:not` selectors (#13577 by @j-f1) - -Pseudo-selectors like `:is`, `:where`, and `:not` that can take multiple selectors as arguments are now formatted like function calls are in other languages. Previously, no special significance was attached to the commas between their “arguments,” leading to confusing wrapping behavior. There are likely still improvements to be made here — please open an issue with some example code if you find something that doesn’t look as expected. - - -```css -/* Input */ -:where( - label > input:valid, - label > textarea:not(:empty), - label > button[disabled] -) ~ .errors > .error { display: none; } - -/* Prettier stable */ -:where(label > input:valid, label > textarea:not(:empty), label - > button[disabled]) - ~ .errors - > .error { - display: none; -} - -/* Prettier main */ -:where( - label > input:valid, - label > textarea:not(:empty), - label > button[disabled] - ) - ~ .errors - > .error { - display: none; -} -``` diff --git a/changelog_unreleased/handlebars/13507.md b/changelog_unreleased/handlebars/13507.md deleted file mode 100644 index 4a67473ebf8d..000000000000 --- a/changelog_unreleased/handlebars/13507.md +++ /dev/null @@ -1,33 +0,0 @@ -#### Correctly format custom "else if" blocks (#13507 by @jamescdavis) - -A template transform can be used to create custom block keywords that behave similar to `if`. This updates printer-glimmer to correctly recognize and format the "else if" case when "if" is a custom keyword. - - -```hbs -{{! Input }} -{{#when isAtWork}} - Ship that code! -{{else when isReading}} - You can finish War and Peace eventually... -{{else}} - Go to bed! -{{/when}} - -{{! Prettier stable }} -{{#when isAtWork}} - Ship that code! -{{else}}{{#when isReading}} - You can finish War and Peace eventually... - {{else}} - Go to bed! - {{/when}}{{/when}} - -{{! Prettier main }} -{{#when isAtWork}} - Ship that code! -{{else when isReading}} - You can finish War and Peace eventually... -{{else}} - Go to bed! -{{/when}} -``` 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/changelog_unreleased/javascript/13274.md b/changelog_unreleased/javascript/13274.md deleted file mode 100644 index 26466f984015..000000000000 --- a/changelog_unreleased/javascript/13274.md +++ /dev/null @@ -1,34 +0,0 @@ -#### Fix inconsistent formatting for multiline strings (#13274 by @GlebDolzhikov) - - -```jsx -// Input -const loremIpsumFooBazBar1 = 'Multiline string\ - Multiline string\ -' - -const loremIpsumFooBazBar2 = 'Multiline string\ - Multiline string\ - Multiline string' - -// Prettier stable -const loremIpsumFooBazBar1 = "Multiline string\ - Multiline string\ -"; - -const loremIpsumFooBazBar2 = - "Multiline string\ - Multiline string\ - Multiline string"; - -// Prettier main -const loremIpsumFooBazBar1 = - "Multiline string\ - Multiline string\ -"; - -const loremIpsumFooBazBar2 = - "Multiline string\ - Multiline string\ - Multiline string"; -``` diff --git a/changelog_unreleased/markdown/11373.md b/changelog_unreleased/markdown/11373.md deleted file mode 100644 index 8eb18b15ed75..000000000000 --- a/changelog_unreleased/markdown/11373.md +++ /dev/null @@ -1,15 +0,0 @@ -#### Preserve inline code line breaks if `--prose-wrap=preserve` (#11373 by @andersk) - - -```markdown - -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod `tempor -incididunt` ut labore et dolore magna aliqua. - - -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod `tempor incididunt` ut labore et dolore magna aliqua. - - -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod `tempor -incididunt` ut labore et dolore magna aliqua. -``` diff --git a/changelog_unreleased/mdx/12208.md b/changelog_unreleased/mdx/12208.md deleted file mode 100644 index df8cd122d8a3..000000000000 --- a/changelog_unreleased/mdx/12208.md +++ /dev/null @@ -1,29 +0,0 @@ -#### Improve MDX range ignore support (#12208 by @nickrttn) - -Adds support for using Markdown [range ignore](https://prettier.io/docs/en/ignore.html#range-ignore) directives in MDX, using JSX comments. - - -```mdx -// Input -{/* prettier-ignore-start */} - -export const Hello = () => { - return (

- Hello

) -} - -{/* prettier-ignore-end */} - -// Prettier stable (throws an error) -TypeError: Cannot read properties of undefined (reading 'type') - -// Prettier main -{/* prettier-ignore-start */} - -export const Hello = () => { - return (

- Hello

) -} - -{/* prettier-ignore-end */} -``` diff --git a/changelog_unreleased/scss/13286.md b/changelog_unreleased/scss/13286.md deleted file mode 100644 index d64d731952d5..000000000000 --- a/changelog_unreleased/scss/13286.md +++ /dev/null @@ -1,13 +0,0 @@ -#### fix: extra space between '#' and '{' (#13286 by @jspereiramoura) - - -```scss -// Input -padding: var(--spacer#{(1) + 2}); - -// Prettier stable -padding: var(--spacer# {(1) + 2}); - -// Prettier main -padding: var(--spacer#{(1) + 2}); -``` diff --git a/changelog_unreleased/typescript/13289.md b/changelog_unreleased/typescript/13289.md deleted file mode 100644 index 7a4183c1969a..000000000000 --- a/changelog_unreleased/typescript/13289.md +++ /dev/null @@ -1,13 +0,0 @@ -#### Fix parens in inferred function return types with `extends` (#13289 by @GlebDolzhikov) - - -```ts -// Input -type Foo = T extends (...a: any[]) => (infer R extends string) ? R : never; - -// Prettier stable -type Foo = T extends (...a: any[]) => infer R extends string ? R : never; - -// Prettier main -type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; -``` diff --git a/docs/browser.md b/docs/browser.md index b0f5403627ed..d5637b9ef6c5 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 - - + + - + +