diff --git a/changelog_unreleased/angular/pr-8253.md b/changelog_unreleased/angular/pr-8253.md deleted file mode 100644 index c808e304d..000000000 --- a/changelog_unreleased/angular/pr-8253.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Fix optional chaining with computed properties and handling of `this` ([#8253](https://github.com/prettier/prettier/pull/8253) by [@thorn0](https://github.com/thorn0), [#7942](https://github.com/prettier/prettier/pull/8253) by [@fisker](https://github.com/fisker), fixes in [`angular-estree-parser`](https://github.com/ikatyang/angular-estree-parser) by [@ikatyang](https://github.com/ikatyang)) - - -```html - -{{ a?.b[c] }} -{{ a ( this )}} - - -{{ (a?.b)[c] }} -{{ a ( this )}} - - -{{ a?.b[c] }} -{{ a(this) }} -``` diff --git a/changelog_unreleased/angular/pr-8254.md b/changelog_unreleased/angular/pr-8254.md deleted file mode 100644 index 0986725a3..000000000 --- a/changelog_unreleased/angular/pr-8254.md +++ /dev/null @@ -1,13 +0,0 @@ -#### Preserve parentheses around pipes in objects literals for compatibility with AngularJS 1.x ([#8254](https://github.com/prettier/prettier/pull/8254) by [@thorn0](https://github.com/thorn0)) - - -```html - -
- - -
- - -
-``` diff --git a/changelog_unreleased/api/pr-7875.md b/changelog_unreleased/api/pr-7875.md deleted file mode 100644 index ff45f937a..000000000 --- a/changelog_unreleased/api/pr-7875.md +++ /dev/null @@ -1,27 +0,0 @@ -#### Add --embedded-language-formatting={auto,off} option ([#7875](https://github.com/prettier/prettier/pull/7875) by [@bakkot](https://github.com/bakkot), [#8825](https://github.com/prettier/prettier/pull/8825) by [@fisker](https://github.com/fiskers)) - -When Prettier identifies cases where it looks like you've placed some code it knows how to format within a string in another file, like in a tagged template in JavaScript with a tag named `html` or in code blocks in Markdown, it will by default try to format that code. - -Sometimes this behavior is undesirable, since it can change the behavior of your code. This option allows you to switch between the default behavior (`auto`) and disabling this feature entirely (`off`). It applies to all languages where Prettier recognizes embedded code, not just JavaScript. - - -```js -// Input -html` -

-I am expecting this to come out exactly like it went in. -`; - -// using --embedded-language-formatting=auto (or omitting this option) -html` -

- I am expecting this to come out exactly like it went in. -

-`; - -// using --embedded-language-formatting=off -html` -

-I am expecting this to come out exactly like it went in. -`; -``` diff --git a/changelog_unreleased/api/pr-8390.md b/changelog_unreleased/api/pr-8390.md deleted file mode 100644 index 416fc26cb..000000000 --- a/changelog_unreleased/api/pr-8390.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Add plugins' parsers to the `parser` option ([#8390](https://github.com/prettier/prettier/pull/8390) by [@thorn0](https://github.com/thorn0)) - -When a plugin defines a language, the parsers specified for this language are now automatically added to the list of valid values of the `parser` option. -This might be useful for editor integrations or other applications that need a list of available parsers. - -```bash -npm install --save-dev --save-exact prettier @prettier/plugin-php -``` - -```js -const hasPhpParser = prettier - .getSupportInfo() - .options.find((option) => option.name === "parser") - .choices.map((choice) => choice.value) - .includes("php"); // false in Prettier stable, true in Prettier master -``` diff --git a/changelog_unreleased/api/pr-8551.md b/changelog_unreleased/api/pr-8551.md deleted file mode 100644 index d51accfba..000000000 --- a/changelog_unreleased/api/pr-8551.md +++ /dev/null @@ -1,29 +0,0 @@ -#### Fix `prettier.getFileInfo()` ([#8548](https://github.com/prettier/prettier/pull/8548), [#8551](https://github.com/prettier/prettier/pull/8551), [#8585](https://github.com/prettier/prettier/pull/8585) by [@fisker](https://github.com/fisker)) - -- When passing `{resolveConfig: true}`, the `inferredParser` should be the parser resolved from config file, previous version might returns wrong result for files supported by builtin parsers. -- When passing `{resolveConfig: true}` and `{ignorePath: "a/file/in/different/dir"}`, the `inferredParser` result might incorrect. -- If given `filePath` is ignored, the `inferredParser` is always `null` now. - - -```console -$ echo {"parser":"flow"}>.prettierrc -$ node -p "require('prettier').getFileInfo.sync('./foo.js', {resolveConfig: true})" - -# Prettier stable -# { ignored: false, inferredParser: 'babel' } - -# Prettier master -# { ignored: false, inferredParser: 'flow' } -``` - - -```console -$ echo ignored.js>>.prettierignore -$ node -p "require('prettier').getFileInfo.sync('./ignored.js')" - -# Prettier stable -# { ignored: true, inferredParser: 'babel' } - -# Prettier master -# { ignored: true, inferredParser: null } -``` diff --git a/changelog_unreleased/api/pr-8591.md b/changelog_unreleased/api/pr-8591.md deleted file mode 100644 index 063c6f6fb..000000000 --- a/changelog_unreleased/api/pr-8591.md +++ /dev/null @@ -1,3 +0,0 @@ -#### Fix resolve editorConfig for files in deep directory ([#8591](https://github.com/prettier/prettier/pull/8591) by [@fisker](https://github.com/fisker)) - -Previous version can't find `.editorconfig` for files in deep directory (depth great than 9 to project root, see #5705). diff --git a/changelog_unreleased/api/pr-8890.md b/changelog_unreleased/api/pr-8890.md deleted file mode 100644 index 9bcfeb182..000000000 --- a/changelog_unreleased/api/pr-8890.md +++ /dev/null @@ -1,7 +0,0 @@ -#### Support `.cjs` and `.json5` configuration files ([#8890](https://github.com/prettier/prettier/pull/8890), [#8957](https://github.com/prettier/prettier/pull/8957) by [@fisker](https://github.com/fisker)) - -Added new format of configuration files: - -- `.prettierrc.json5` -- `.prettierrc.cjs` -- `prettier.config.cjs` diff --git a/changelog_unreleased/api/pr-8936.md b/changelog_unreleased/api/pr-8936.md deleted file mode 100644 index 33f7941f0..000000000 --- a/changelog_unreleased/api/pr-8936.md +++ /dev/null @@ -1,28 +0,0 @@ -#### Fix wrong range format on files with BOM ([#8936](https://github.com/prettier/prettier/pull/8936) by [@fisker](https://github.com/fisker)) - -When files have BOM, in previous version, the real range is wrongly calculated. - - -```js -const text = "\uFEFF" + "foo = 1.0000;bar = 1.0000;"; -// ^^^^^^^^^^^^^ Range -const result = require("prettier") - .format(text, { - parser: "babel", - rangeStart: 1, - rangeEnd: 13, - }) - // Visualize BOM - .replace("\uFEFF", "<>") - // Visualize EOL - .replace("\n", "<>"); - -console.log(result); - -// Prettier stable -// -> <>foo = 1.0;<>bar = 1.0; -// ^^^^^^^^^ This part should not be formatted - -// Prettier master -// -> <>foo = 1.0;bar = 1.0000; -``` diff --git a/changelog_unreleased/cli/pr-8098.md b/changelog_unreleased/cli/pr-8098.md deleted file mode 100644 index f00330b52..000000000 --- a/changelog_unreleased/cli/pr-8098.md +++ /dev/null @@ -1,15 +0,0 @@ -#### Fix filenames contains CJK or emoji not correctly ignored ([#8098](https://github.com/prettier/prettier/pull/8098) by [@fisker](https://github.com/fisker)) - -```console -// Prettier stable -$ echo "dir" > .prettierignore -$ prettier **/*.js -l -dir/😁.js -dir/中文.js -not-ignored.js - -// Prettier master -$ echo "dir" > .prettierignore -$ prettier **/*.js -l -not-ignored.js -``` diff --git a/changelog_unreleased/cli/pr-8586.md b/changelog_unreleased/cli/pr-8586.md deleted file mode 100644 index a30a36166..000000000 --- a/changelog_unreleased/cli/pr-8586.md +++ /dev/null @@ -1,17 +0,0 @@ -#### `--file-info` respect the `.prettierrc` and `--no-config` ([#8586](https://github.com/prettier/prettier/pull/8586), [#8830](https://github.com/prettier/prettier/pull/8830) by [@fisker](https://github.com/fisker)) - -```console -$ echo {"parser":"ninja"}>.prettierrc - -# Prettier stable -$ prettier --file-info file.js -# { "ignored": false, "inferredParser": "babel" } -$ prettier --file-info file.js --no-config -# { "ignored": false, "inferredParser": "babel" } - -# Prettier master -$ prettier --file-info file.js -# { "ignored": false, "inferredParser": "ninja" } -$ prettier --file-info file.js --no-config -# { "ignored": false, "inferredParser": "babel" } -``` diff --git a/changelog_unreleased/cli/pr-8829.md b/changelog_unreleased/cli/pr-8829.md deleted file mode 100644 index 1d81c3806..000000000 --- a/changelog_unreleased/cli/pr-8829.md +++ /dev/null @@ -1,14 +0,0 @@ -#### Added `--ignore-unknown`(alias `-u`) flag ([#8829](https://github.com/prettier/prettier/pull/8829) by [@fisker](https://github.com/fisker)) - -```console -# Prettier stable -npx prettier * --check -Checking formatting... -foo.unknown[error] No parser could be inferred for file: foo.unknown -All matched files use Prettier code style! - -# Prettier master -npx prettier * --check --ignore-unknown -Checking formatting... -All matched files use Prettier code style! -``` diff --git a/changelog_unreleased/cli/pr-8833.md b/changelog_unreleased/cli/pr-8833.md deleted file mode 100644 index 956f7e814..000000000 --- a/changelog_unreleased/cli/pr-8833.md +++ /dev/null @@ -1,14 +0,0 @@ -#### Add `-w` alias for `--write` option ([#8833](https://github.com/prettier/prettier/pull/8833) by [@fisker](https://github.com/fisker)) - -```console -# Prettier stable -$ prettier index.js -w -[warn] Ignored unknown option -w. Did you mean -_? -"use strict"; - -module.exports = require("./src/index"); - -# Prettier master -$ prettier index.js -w -index.js 30ms -``` diff --git a/changelog_unreleased/cli/pr-8934.md b/changelog_unreleased/cli/pr-8934.md deleted file mode 100644 index a3d1409a5..000000000 --- a/changelog_unreleased/cli/pr-8934.md +++ /dev/null @@ -1,11 +0,0 @@ -#### Stop suggesting `-_` for unknown options ([#8934](https://github.com/prettier/prettier/pull/8934) by [@fisker](https://github.com/fisker)) - -```console -# Prettier stable -$ prettier foo.js -a -[warn] Ignored unknown option -a. Did you mean -_? - -# Prettier master -$ prettier foo.js -a -[warn] Ignored unknown option -a. Did you mean -c? -``` diff --git a/changelog_unreleased/css/pr-7009.md b/changelog_unreleased/css/pr-7009.md deleted file mode 100644 index 167f12e54..000000000 --- a/changelog_unreleased/css/pr-7009.md +++ /dev/null @@ -1,22 +0,0 @@ -#### Do not break code with a comment at the end of an at-rule ([#7009](https://github.com/prettier/prettier/pull/7009) by [@evilebottnawi](https://github.com/evilebottnawi)) - - -```scss -/* Input */ -@at-root .foo -// .bar -{ - -} - -/* Prettier stable */ -@at-root .foo -// .bar { -} - -/* Prettier master */ -@at-root .foo -// .bar -{ -} -``` diff --git a/changelog_unreleased/css/pr-7592.md b/changelog_unreleased/css/pr-7592.md deleted file mode 100644 index 5c010e03e..000000000 --- a/changelog_unreleased/css/pr-7592.md +++ /dev/null @@ -1,49 +0,0 @@ -#### Fix url() unquoted content manipulation ([#7592](https://github.com/prettier/prettier/pull/7592) by [@mattiacci](https://github.com/mattiacci)) - -Improve the handling of unquoted URL content in CSS/SCSS/Less. This doesn't -address the underlying parsing issues, but at least ensures Prettier doesn't -modify URLs. - - -```css -/* Input */ -@import url(https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap); -@import url(//fonts.googleapis.com/css?family=#{ get-font-family('Roboto') }:100,300,500,700,900&display=swap); -.validUnquotedUrls{ - background: url(data/+0ThisShouldNotBeLowerCased); - background: url(https://foo/A*3I8oSY6AKRMAAAAAAAAAAABkARQnAQ); - background: url(https://example.com/some/quite,long,url,with,commas.jpg); -} - -/* Prettier stable */ -@import url( - https://fonts.googleapis.com/css?family=Roboto:100, - 300, - 400, - 500, - 700, - 900&display=swap -); -@import url( - //fonts.googleapis.com/css?family=#{get-font-family("Roboto")}:100, - 300, - 500, - 700, - 900&display=swap -); -.validUnquotedUrls { - background: url(data/+0thisshouldnotbelowercased); - background: url(https://foo/A*3i8osy6akrmaaaaaaaaaaabkarqnaq); - background: url(https://example.com/some/quite, long, url, with, commas.jpg); -} - - -/* Prettier master */ -@import url(https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap); -@import url(//fonts.googleapis.com/css?family=#{ get-font-family('Roboto') }:100,300,500,700,900&display=swap); -.validUnquotedUrls{ - background: url(data/+0ThisShouldNotBeLowerCased); - background: url(https://foo/A*3I8oSY6AKRMAAAAAAAAAAABkARQnAQ); - background: url(https://example.com/some/quite,long,url,with,commas.jpg); -} -``` diff --git a/changelog_unreleased/css/pr-7844.md b/changelog_unreleased/css/pr-7844.md deleted file mode 100644 index 31d78cefc..000000000 --- a/changelog_unreleased/css/pr-7844.md +++ /dev/null @@ -1,29 +0,0 @@ -#### Fix extra indentation of lines following comments in scss ([#7844](https://github.com/prettier/prettier/pull/7844) by [@boyenn](https://github.com/boyenn)) - -Previously, Prettier would place extra indentation of lines following comments within SCSS maps -Prettier now no longer places these indentations - - -```css -/* Input */ -$my-map: ( - 'foo': 1, // Foo - 'bar': 2, // Bar -); - -/* Prettier stable */ -$my-map: ( - "foo": 1, - // Foo - "bar": 2, - // Bar -); - -/* Prettier master */ -$my-map: ( - "foo": 1, - // Foo - "bar": 2, - // Bar -); -``` diff --git a/changelog_unreleased/css/pr-8535.md b/changelog_unreleased/css/pr-8535.md deleted file mode 100644 index 2bf9d6b78..000000000 --- a/changelog_unreleased/css/pr-8535.md +++ /dev/null @@ -1,20 +0,0 @@ -#### Incorrect whitespace added after escaped colon in css grid line name ([#8535](https://github.com/prettier/prettier/pull/8535) by [@boyenn](https://github.com/boyenn)) - - -```css -/* Input */ -.grid { - grid-template-rows: - [row-1-00\:00] auto; -} - -/* Prettier stable */ -.grid { - grid-template-rows: [row-1-00\: 00] auto; -} - -/* Prettier master */ -.grid { - grid-template-rows: [row-1-00\:00] auto; -} -``` diff --git a/changelog_unreleased/css/pr-8545.md b/changelog_unreleased/css/pr-8545.md deleted file mode 100644 index c262bba16..000000000 --- a/changelog_unreleased/css/pr-8545.md +++ /dev/null @@ -1,37 +0,0 @@ -#### Add support for @supports selector() ([#8545](https://github.com/prettier/prettier/pull/8545) by [@boyenn](https://github.com/boyenn)) - - -```css -/* Input */ -@supports selector(:focus-visible) { - button:focus { - outline: none; - } - - button:focus-visible { - outline: 2px solid orange; - } -} - -/* Prettier stable */ -@supports selector(: focus-visible) { - button:focus { - outline: none; - } - - button:focus-visible { - outline: 2px solid orange; - } -} - -/* Prettier master */ -@supports selector(:focus-visible) { - button:focus { - outline: none; - } - - button:focus-visible { - outline: 2px solid orange; - } -} -``` diff --git a/changelog_unreleased/css/pr-8567.md b/changelog_unreleased/css/pr-8567.md deleted file mode 100644 index ca8637d99..000000000 --- a/changelog_unreleased/css/pr-8567.md +++ /dev/null @@ -1,28 +0,0 @@ -#### Improve Prettier handling of arbitrary arguments ([#8567](https://github.com/prettier/prettier/pull/8567), [#8566](https://github.com/prettier/prettier/pull/8566) by [@boyenn](https://github.com/boyenn)) - -Prettier no longer unexpectedly add extra space after function when passing arbitrary arguments. -Prettier no longer breaks code when inline number lists are used as arbitrary arguments. - - -```css -/* Input */ -body { - test: function($list...); - foo: bar(returns-list($list)...); - background-color: rgba(50 50 50 50...); -} - -/* Prettier stable */ -body { - test: function($list...); - foo: bar(returns-list($list) ...); - background-color: rgba(50 50 50 50..); -} - -/* Prettier master */ -body { - test: function($list...); - foo: bar(returns-list($list)...); - background-color: rgba(50 50 50 50...); -} -``` diff --git a/changelog_unreleased/flow/pr-8365.md b/changelog_unreleased/flow/pr-8365.md deleted file mode 100644 index 2a1be3199..000000000 --- a/changelog_unreleased/flow/pr-8365.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Fix function type param contains nullable param ([#8365](https://github.com/prettier/prettier/pull/8365) by [@fisker](https://github.com/fisker)) - - -```flow -// Input -let f: ( - ((?A) => B), -) => B; - -// Prettier stable -let f: ((?A) => B) => B; - -// Prettier stable (Second format) -SyntaxError: Unexpected token (1:12) -> 1 | let f: ((?A) => B) => B; - -// Prettier master -let f: (((?A) => B)) => B; -``` diff --git a/changelog_unreleased/flow/pr-8768.md b/changelog_unreleased/flow/pr-8768.md deleted file mode 100644 index 10bcae8f0..000000000 --- a/changelog_unreleased/flow/pr-8768.md +++ /dev/null @@ -1,15 +0,0 @@ -#### Fix export default of Flow Enum ([#8768](https://github.com/prettier/prettier/pull/8768) by [@gkz](https://github.com/gkz)) - -Do not add a trailing semicolon if default exporting a Flow Enum. - - -```jsx -// Input -export default enum B {} - -// Prettier stable -export default enum B {}; - -// Prettier master -export default enum B {} -``` diff --git a/changelog_unreleased/graphql/pr-7721.md b/changelog_unreleased/graphql/pr-7721.md deleted file mode 100644 index 0372dbb93..000000000 --- a/changelog_unreleased/graphql/pr-7721.md +++ /dev/null @@ -1,23 +0,0 @@ -#### Improve wrapping of GraphQL fragment directives ([#7721](https://github.com/prettier/prettier/pull/7721) by [@sasurau4](https://github.com/sasurau4)) - - -```graphql -# Input -fragment TodoList_list on TodoList @argumentDefinitions( - count: {type: "Int", defaultValue: 10}, -) { - title -} - -# Prettier stable -fragment TodoList_list on TodoList - @argumentDefinitions(count: { type: "Int", defaultValue: 10 }) { - title -} - -# Prettier master -fragment TodoList_list on TodoList -@argumentDefinitions(count: { type: "Int", defaultValue: 10 }) { - title -} -``` diff --git a/changelog_unreleased/graphql/pr-8006.md b/changelog_unreleased/graphql/pr-8006.md deleted file mode 100644 index 29892f724..000000000 --- a/changelog_unreleased/graphql/pr-8006.md +++ /dev/null @@ -1,33 +0,0 @@ -#### Fix comments between interfaces ([#8006](https://github.com/prettier/prettier/pull/8006) by [@fisker](https://github.com/fisker)) - - -```graphql -# Input -type Type1 implements - A & -# comment 1 - B -# comment 2 - & C {a: a} - -# Prettier stable -type Type1 implements A & # comment 1 -B & # comment 2 -C { - a: a -} - -# Prettier stable (Second format) -type Type1 implements A & B & C { # comment 1 # comment 2 - a: a -} - -# Prettier master -type Type1 implements A & -# comment 1 -B & -# comment 2 -C { - a: a -} -``` diff --git a/changelog_unreleased/graphql/pr-8007.md b/changelog_unreleased/graphql/pr-8007.md deleted file mode 100644 index 686257173..000000000 --- a/changelog_unreleased/graphql/pr-8007.md +++ /dev/null @@ -1,24 +0,0 @@ -#### Allow interfaces to implement other interfaces ([#8007](https://github.com/prettier/prettier/pull/8007) by [@fisker](https://github.com/fisker)) - -See ["RFC: Allow interfaces to implement other interfaces"](https://github.com/graphql/graphql-spec/pull/373) - - -```graphql -# Input -interface Resource implements Node { - id: ID! - url: String -} - -# Prettier stable -interface Resource { - id: ID! - url: String -} - -# Prettier master -interface Resource implements Node { - id: ID! - url: String -} -``` diff --git a/changelog_unreleased/handlebars/pr-8375.md b/changelog_unreleased/handlebars/pr-8375.md deleted file mode 100644 index 5dbe03b7e..000000000 --- a/changelog_unreleased/handlebars/pr-8375.md +++ /dev/null @@ -1,25 +0,0 @@ -#### Respect singleQuote option around attribute value more complex than a bare text ([#8375](https://github.com/prettier/prettier/pull/8375) by [@dcyriller](https://github.com/dcyriller) - - -```hbs -{{!-- Input --}} - - - - - - -{{!-- Prettier stable --}} - - - - - - -{{!-- Prettier master --}} - - - - - -``` diff --git a/changelog_unreleased/handlebars/pr-8593.md b/changelog_unreleased/handlebars/pr-8593.md deleted file mode 100644 index 09cc955c2..000000000 --- a/changelog_unreleased/handlebars/pr-8593.md +++ /dev/null @@ -1,35 +0,0 @@ -#### Fix formatting of classic components inside element ([#8593](https://github.com/prettier/prettier/pull/8593) by [@mikoscz](https://github.com/mikoscz) - - -```hbs -{{!-- Input --}} -

- {{classic-component-with-many-properties - class="hello" - param=this.someValue - secondParam=this.someValue - thirdParam=this.someValue - }} -
- -{{!-- Prettier stable --}} -
- {{ - classic-component-with-many-properties - class="hello" - param=this.someValue - secondParam=this.someValue - thirdParam=this.someValue - }} -
- -{{!-- Prettier master --}} -
- {{classic-component-with-many-properties - class="hello" - param=this.someValue - secondParam=this.someValue - thirdParam=this.someValue - }} -
-``` diff --git a/changelog_unreleased/handlebars/pr-8634.md b/changelog_unreleased/handlebars/pr-8634.md deleted file mode 100644 index 85b7821f8..000000000 --- a/changelog_unreleased/handlebars/pr-8634.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Support escaping a mustache with a backslash ([#8634](https://github.com/prettier/prettier/pull/8634) by [@dcyriller](https://github.com/dcyriller) - - -```hbs -{{!-- Input --}} -\{{mustache}} -\\{{mustache}} -\\\{{mustache}} - -{{!-- Prettier stable --}} -{{mustache}} -\{{mustache}} -\\{{mustache}} - -{{!-- Prettier master --}} -\{{mustache}} -\\{{mustache}} -\\\{{mustache}} -``` diff --git a/changelog_unreleased/handlebars/pr-8677.md b/changelog_unreleased/handlebars/pr-8677.md deleted file mode 100644 index 4ee4e3445..000000000 --- a/changelog_unreleased/handlebars/pr-8677.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Format only class names in attributes ([#8677](https://github.com/prettier/prettier/pull/8677) by [@dcyriller](https://github.com/dcyriller) - - -```hbs -{{!-- Input --}} -
-
- -{{!-- Prettier stable --}} -
-
- -{{!-- Prettier master --}} -
-
-``` diff --git a/changelog_unreleased/html/pr-8013.md b/changelog_unreleased/html/pr-8013.md deleted file mode 100644 index 7dd2739da..000000000 --- a/changelog_unreleased/html/pr-8013.md +++ /dev/null @@ -1,32 +0,0 @@ -#### Omit trailing semicolon on single line style attributes ([#8013](https://github.com/prettier/prettier/pull/8013) by [@bschlenk](https://github.com/bschlenk)) - - -```html - -
-
- - -
-
- - -
-
-``` diff --git a/changelog_unreleased/html/pr-8137.md b/changelog_unreleased/html/pr-8137.md deleted file mode 100644 index d602bac34..000000000 --- a/changelog_unreleased/html/pr-8137.md +++ /dev/null @@ -1,20 +0,0 @@ -#### Preserve non-ASCII whitespace characters in HTML ([#8137](https://github.com/prettier/prettier/pull/8137) by [@fisker](https://github.com/fisker)) - -Non-ASCII whitespace characters like `U+00A0` `U+2005` etc. are not considered whitespace in html, they should not be removed. - -```js -// Prettier stable -[...require("prettier").format(" \u2005 ", { parser: "html" })] - .slice(3, -5) - .map((c) => c.charCodeAt(0).toString(16)); - -// -> [ '20' ] -// `U+2005` is removed - -// Prettier master -[...require("prettier").format(" \u2005 ", { parser: "html" })] - .slice(3, -5) - .map((c) => c.charCodeAt(0).toString(16)); - -// -> [ '20', '2005', '20' ] -``` diff --git a/changelog_unreleased/html/pr-8173.md b/changelog_unreleased/html/pr-8173.md deleted file mode 100644 index e08af3f8e..000000000 --- a/changelog_unreleased/html/pr-8173.md +++ /dev/null @@ -1,30 +0,0 @@ -#### Support legacy HTML-like comments script blocks ([#8173](https://github.com/prettier/prettier/pull/8173) by [@fisker](https://github.com/fisker), [#8394](https://github.com/prettier/prettier/pull/8394) by [@fisker](https://github.com/fisker)) - -Previously we parse html ` - - -SyntaxError: Unexpected token (2:1) - 1 | -> 2 | - - - -``` diff --git a/changelog_unreleased/html/pr-8275.md b/changelog_unreleased/html/pr-8275.md deleted file mode 100644 index d498b177b..000000000 --- a/changelog_unreleased/html/pr-8275.md +++ /dev/null @@ -1,28 +0,0 @@ -#### Treat ` - - - - - - -``` diff --git a/changelog_unreleased/html/pr-8359.md b/changelog_unreleased/html/pr-8359.md deleted file mode 100644 index 534a2c1e3..000000000 --- a/changelog_unreleased/html/pr-8359.md +++ /dev/null @@ -1,32 +0,0 @@ -#### Fix broken URLs with commas in srcset ([#8359](https://github.com/prettier/prettier/pull/8359) by [@fisker](https://github.com/fisker)) - - -```html - - - - - - - - -``` diff --git a/changelog_unreleased/html/pr-8371.md b/changelog_unreleased/html/pr-8371.md deleted file mode 100644 index 2d5fd8114..000000000 --- a/changelog_unreleased/html/pr-8371.md +++ /dev/null @@ -1,26 +0,0 @@ -#### Support ` - - - - - - - -``` diff --git a/changelog_unreleased/html/pr-8381.md b/changelog_unreleased/html/pr-8381.md deleted file mode 100644 index edca15dda..000000000 --- a/changelog_unreleased/html/pr-8381.md +++ /dev/null @@ -1,31 +0,0 @@ -#### Support front matter with dynamic language ([#8381](https://github.com/prettier/prettier/pull/8381) by [@fisker](https://github.com/fisker)) - -Support [dynamic language detection](https://github.com/jonschlinkert/gray-matter#optionslanguage) in front matter, also available for `css`, `less`, `scss`, and `markdown` parser. - - -```html - ----my-awsome-language -title: Title -description: Description ---- -

- prettier

- - ----my-awsome-language title: Title description: Description --- - -

- prettier -

- - ----my-awsome-language -title: Title -description: Description ---- - -

- prettier -

-``` diff --git a/changelog_unreleased/html/pr-8614.md b/changelog_unreleased/html/pr-8614.md deleted file mode 100644 index 19d77a66a..000000000 --- a/changelog_unreleased/html/pr-8614.md +++ /dev/null @@ -1,26 +0,0 @@ -#### Don't preserve line breaks around text-only content ([#8614](https://github.com/prettier/prettier/pull/8614) by [@fisker](https://github.com/fisker)) - -Previously, Prettier always [preserved line breaks][#5596] around inline nodes (i.e. inline elements, text, interpolations). In general, Prettier, as much as possible, tries to avoid relying on original formatting, but there are at least two cases when collapsing inline nodes into a single line is undesirable, namely list-like content and conditional constructions (e.g. `v-if`/`v-else` in Vue). A good way to detect those cases couldn't be found, so such a trade-off was made. It turned out, however, for text-only content, this relaxation of rules was unnecessary and only led to confusingly inconsistent formatting. - - -```html - -
- Hello, world! -
-
- Hello, {{ username }}! -
- - -
- Hello, world! -
-
Hello, {{ username }}!
- - -
Hello, world!
-
Hello, {{ username }}!
-``` - -[#5596]: https://prettier.io/blog/2019/01/20/1.16.0.html#respect-surrounding-linebreaks-5596-by-ikatyang diff --git a/changelog_unreleased/html/pr-8621.md b/changelog_unreleased/html/pr-8621.md deleted file mode 100644 index 0f3ac9a09..000000000 --- a/changelog_unreleased/html/pr-8621.md +++ /dev/null @@ -1,47 +0,0 @@ -#### Recognize known html tags ([#8621](https://github.com/prettier/prettier/pull/8621) by [@fisker](https://github.com/fisker)) - - -```html - -
before
summary long long long long details
after
-
beforedialog long long long long long long long long after
-
beforeafter
- - -
- before
summary long long long long details
after -
-
- beforedialog long long long long long long long long after -
-
- beforeafter -
- - -
- before -
- summary long long long long - details -
- after -
-
- before - dialog long long long long long long long long - after -
-
- before - - after -
-``` diff --git a/changelog_unreleased/html/pr-8643.md b/changelog_unreleased/html/pr-8643.md deleted file mode 100644 index ccc73b85f..000000000 --- a/changelog_unreleased/html/pr-8643.md +++ /dev/null @@ -1,25 +0,0 @@ -#### Fix formatting element with void element as its last child ([#8643](https://github.com/prettier/prettier/pull/8643) by [@ikatyang](https://github.com/ikatyang)) - - -```html - -text after - - -text after - - -text after -``` diff --git a/changelog_unreleased/javascript/pr-6319.md b/changelog_unreleased/javascript/pr-6319.md deleted file mode 100644 index ad225e38d..000000000 --- a/changelog_unreleased/javascript/pr-6319.md +++ /dev/null @@ -1,37 +0,0 @@ -#### Support the F# and Smart pipeline operator proposals ([#6319](https://github.com/prettier/prettier/pull/6319) by [@sosukesuzuki](https://github.com/sosukesuzuki), [@thorn0](https://github.com/thorn0), [#7979](https://github.com/prettier/prettier/pull/7979) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - -- [F# Pipeline Operator proposal](https://github.com/valtech-nyc/proposal-fsharp-pipelines) -- [Smart Pipelines proposal](https://github.com/js-choi/proposal-smart-pipelines) -- [Babel Blog: What's Happening With the Pipeline (`|>`) Proposal?](https://babeljs.io/blog/2018/07/19/whats-happening-with-the-pipeline-proposal) - -**F#-style Pipeline:** - - -```js -// Input -promises |> await; - -// Output (Prettier stable) -SyntaxError: Unexpected token (1:18) -> 1 | promises |> await; - | ^ - -// Output (Prettier master) -promises |> await; -``` - -**Smart Pipeline:** - - -```js -// Input -5 |> # * 2 - -// Output (Prettier Stable) -SyntaxError: Unexpected character '#' (1:6) -> 1 | 5 |> # * 2 - | ^ - -// Output (Prettier master) -5 |> # * 2 -``` diff --git a/changelog_unreleased/javascript/pr-8069.md b/changelog_unreleased/javascript/pr-8069.md deleted file mode 100644 index 121f9a54d..000000000 --- a/changelog_unreleased/javascript/pr-8069.md +++ /dev/null @@ -1,33 +0,0 @@ -#### Fix end-of-line comments if followed by trailing whitespace ([#8069](https://github.com/prettier/prettier/pull/8069) by [@shisama](https://github.com/shisama)) - -If comments line has trailing whitespaces, comments aren't detected as end-of-line. - - -```jsx -// Input -var a = { /* extra whitespace --> */ - b }; - -var a = { /* no whitespace --> */ - b }; - -// Prettier stable -var a = { - /* extra whitespace --> */ - - b, -}; - -var a = { - /* no whitespace --> */ b, -}; - -// Prettier master -var a = { - /* extra whitespace --> */ b, -}; - -var a = { - /* no whitespace --> */ b, -}; -``` diff --git a/changelog_unreleased/javascript/pr-8097.md b/changelog_unreleased/javascript/pr-8097.md deleted file mode 100644 index 7e3db9efc..000000000 --- a/changelog_unreleased/javascript/pr-8097.md +++ /dev/null @@ -1,44 +0,0 @@ -#### Fix inconsistent parsing of injected expressions in styled-components template literals ([#8097](https://github.com/prettier/prettier/pull/8097) by [@thecodrr](https://github.com/thecodrr)) - - -```js -// Input -const SingleConcat = styled.div` - ${something()} - & > ${Child}:not(:first-child) { -margin-left:5px; -} -` - -const MultiConcats = styled.div` - ${something()} - & > ${Child}${Child2}:not(:first-child) { -margin-left:5px; -} -` - -const SeparatedConcats = styled.div` -font-family: "${a}", "${b}"; -` - -// Prettier stable -- same as input - -// Prettier master -const SingleConcat = styled.div` - ${something()} - & > ${Child}:not(:first-child) { - margin-left: 5px; - } -`; - -const MultiConcats = styled.div` - ${something()} - & > ${Child}${Child2}:not(:first-child) { - margin-left: 5px; - } -`; - -const SeparatedConcats = styled.div` - font-family: "${a}", "${b}"; -`; -``` diff --git a/changelog_unreleased/javascript/pr-8111.md b/changelog_unreleased/javascript/pr-8111.md deleted file mode 100644 index 6f41418c0..000000000 --- a/changelog_unreleased/javascript/pr-8111.md +++ /dev/null @@ -1,22 +0,0 @@ -#### Fix object trailing commas that last property is ignored ([#8111](https://github.com/prettier/prettier/pull/8111) by [@fisker](https://github.com/fisker)) - - -```js -// Input -const foo = { - // prettier-ignore - bar: "baz" -} - -// Prettier stable -const foo = { - // prettier-ignore - bar: "baz" -}; - -// Prettier master -const foo = { - // prettier-ignore - bar: "baz", -}; -``` diff --git a/changelog_unreleased/javascript/pr-8160.md b/changelog_unreleased/javascript/pr-8160.md deleted file mode 100644 index 5cebb6ea7..000000000 --- a/changelog_unreleased/javascript/pr-8160.md +++ /dev/null @@ -1,20 +0,0 @@ -#### Keep object key with escape sequence as it is ([#8160](https://github.com/prettier/prettier/pull/8160) by [@fisker](https://github.com/fisker)) - - -```js -// Input -const a = { - "\u2139": 'why "\\u2139" converted to "i"?', -}; - -// Prettier stable -const a = { - ℹ: 'why "\\u2139" converted to "i"?', -}; - - -// Prettier master -const a = { - "\u2139": 'why "\\u2139" is converted to "i"?', -}; -``` diff --git a/changelog_unreleased/javascript/pr-8255.md b/changelog_unreleased/javascript/pr-8255.md deleted file mode 100644 index a5eb3b5d0..000000000 --- a/changelog_unreleased/javascript/pr-8255.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Fix extra space after minus in CSS-in-JS ([#8255](https://github.com/prettier/prettier/pull/8255) by [@thorn0](https://github.com/thorn0)) - - -```js -// Input -css` -color: var(--global--color--${props.color}); -` - -// Prettier stable -css` - color: var(--global--color-- ${props.color}); -`; - -// Prettier master -css` - color: var(--global--color--${props.color}); -`; -``` diff --git a/changelog_unreleased/javascript/pr-8312.md b/changelog_unreleased/javascript/pr-8312.md deleted file mode 100644 index 7b25b341a..000000000 --- a/changelog_unreleased/javascript/pr-8312.md +++ /dev/null @@ -1,20 +0,0 @@ -#### Fix comments in the `extends` part of class declarations/expressions ([#8312](https://github.com/prettier/prettier/pull/8312) by [@thorn0](https://github.com/thorn0)) - - -```jsx -// Input -class a extends a // comment -{ - constructor() {} -} - -// Prettier stable -class a extends a // comment { - constructor() {} -} - -// Prettier master -class a extends a { // comment - constructor() {} -} -``` diff --git a/changelog_unreleased/javascript/pr-8354.md b/changelog_unreleased/javascript/pr-8354.md deleted file mode 100644 index 3fa1bd651..000000000 --- a/changelog_unreleased/javascript/pr-8354.md +++ /dev/null @@ -1,25 +0,0 @@ -#### Don't wrap arrays in Jest `test.each` template strings ([#8354](https://github.com/prettier/prettier/pull/8354) by [@yogmel](https://github.com/yogmel)) - - -```jsx -// Input -test.each` -a | b | c -${1} | ${[{ start: 1, end: 3 },{ start: 15, end: 20 },]} | ${[]} -`("example test", ({a, b, c}) => {}) - -// Prettier stable -test.each` - a | b | c - ${1} | ${[ - { start: 1, end: 3 }, - { start: 15, end: 20 } -]} | ${[]} -`("example test", ({ a, b, c }) => {}); - -// Prettier master -test.each` - a | b | c - ${1} | ${[{ start: 1, end: 3 }, { start: 15, end: 20 }]} | ${[]} -`("example test", ({ a, b, c }) => {}); -``` diff --git a/changelog_unreleased/javascript/pr-8376.md b/changelog_unreleased/javascript/pr-8376.md deleted file mode 100644 index 90ae89242..000000000 --- a/changelog_unreleased/javascript/pr-8376.md +++ /dev/null @@ -1,49 +0,0 @@ -#### Support `insertPragma` and `requirePragma` in files has shebang ([#8376](https://github.com/prettier/prettier/pull/8376) by [@fisker](https://github.com/fisker)) - - -```js -// `--insert-pragma` -// Input -#!/usr/bin/env node -hello - .world(); - -// Prettier stable -SyntaxError: Unexpected token (3:1) - 1 | /** @format */ - 2 | -> 3 | #!/usr/bin/env node - | ^ - 4 | hello - 5 | .world(); - -// Prettier master -#!/usr/bin/env node -/** @format */ - -hello.world(); - -// `--require-pragma` -// Input -#!/usr/bin/env node -/** - * @format - */ -hello - .world(); - -// Prettier stable -#!/usr/bin/env node -/** - * @format - */ -hello - .world(); - -// Prettier master -#!/usr/bin/env node -/** - * @format - */ -hello.world(); -``` diff --git a/changelog_unreleased/javascript/pr-8410.md b/changelog_unreleased/javascript/pr-8410.md deleted file mode 100644 index 0a3420bfe..000000000 --- a/changelog_unreleased/javascript/pr-8410.md +++ /dev/null @@ -1,18 +0,0 @@ -#### Fix range formatting indentation ([#8410](https://github.com/prettier/prettier/pull/8410) by [@thorn0](https://github.com/thorn0)) - -```console -> echo -e "export default class Foo{\n/**/\n}" | prettier --range-start 16 --range-end 31 --parser babel -``` - - -```js -// Prettier stable -export default class Foo { - /**/ - } - -// Prettier master -export default class Foo { - /**/ -} -``` diff --git a/changelog_unreleased/javascript/pr-8419.md b/changelog_unreleased/javascript/pr-8419.md deleted file mode 100644 index f3a7d5794..000000000 --- a/changelog_unreleased/javascript/pr-8419.md +++ /dev/null @@ -1,18 +0,0 @@ -#### Improve detection of source elements for range formatting ([#8419](https://github.com/prettier/prettier/pull/8419) by [@thorn0](https://github.com/thorn0)) - -Not all statement types were detected (read [here](https://prettier.io/docs/en/options.html#range) how range formatting works in Prettier). - - -```jsx -// Input -for (const element of list) { /* ... */ } -// ^^^^^^^^^^^^^^^^^^^^^^ ← range - -// Prettier stable -for (const element of list) { /* ... */ } - -// Prettier master -for (const element of list) { - /* ... */ -} -``` diff --git a/changelog_unreleased/javascript/pr-8431.md b/changelog_unreleased/javascript/pr-8431.md deleted file mode 100644 index 79203af35..000000000 --- a/changelog_unreleased/javascript/pr-8431.md +++ /dev/null @@ -1,18 +0,0 @@ -#### Support Private Fields in `in` ([#8431](https://github.com/prettier/prettier/pull/8431) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - -Support Stage-2 proposal [Private Fields in `in`](https://github.com/tc39/proposal-private-fields-in-in/blob/master/README.md). - - -```js -// Input -#prop in obj; - -// Prettier stable -SyntaxError: Unexpected token (1:1) -> 1 | #prop in obj; - | ^ - 2 | - -// Prettier master -#prop in obj; -``` diff --git a/changelog_unreleased/javascript/pr-8436.md b/changelog_unreleased/javascript/pr-8436.md deleted file mode 100644 index fb9583905..000000000 --- a/changelog_unreleased/javascript/pr-8436.md +++ /dev/null @@ -1,17 +0,0 @@ -#### Support ES Module Attributes and JSON modules ([#8436](https://github.com/prettier/prettier/pull/8436) by [@fisker](https://github.com/fisker)) - -Support Stage-1 proposal [ES Module Attributes and JSON modules](https://github.com/tc39/proposal-module-attributes). - - -```js -// Input -import foo from "foo.json" with type: "json"; - -// Prettier stable -SyntaxError: Unexpected token, expected ";" (1:28) -> 1 | import foo from "foo.json" with type: "json"; - | ^ - -// Prettier master -import foo from "foo.json" with type: "json"; -``` diff --git a/changelog_unreleased/javascript/pr-8453.md b/changelog_unreleased/javascript/pr-8453.md deleted file mode 100644 index e0d010695..000000000 --- a/changelog_unreleased/javascript/pr-8453.md +++ /dev/null @@ -1,50 +0,0 @@ -#### Support record and tuple syntax ([#8453](https://github.com/prettier/prettier/pull/8453) by [@fisker](https://github.com/fisker)) - -Support Stage-1 proposal [JavaScript Records & Tuples Proposal](https://github.com/tc39/proposal-record-tuple/blob/master/README.md). - -_Only support `#[]`/`#{}` syntax, not `{| |}` / `[| |]`._ - -**Tuples** - - -```js -// Input -#[1, 2, 3] - -// Prettier stable -SyntaxError: Unexpected token (1:1) -> 1 | #[1, 2, 3] - | ^ - - -// Prettier master -#[1, 2, 3]; -``` - -**Records** - - -```js -// Input -#{ - a: 1, - b: 2, - c: 3, -} - -// Prettier stable -SyntaxError: Unexpected token (1:1) -> 1 | #{ - | ^ - 2 | a: 1, - 3 | b: 2, - 4 | c: 3, - - -// Prettier master -#{ - a: 1, - b: 2, - c: 3, -}; -``` diff --git a/changelog_unreleased/javascript/pr-8461.md b/changelog_unreleased/javascript/pr-8461.md deleted file mode 100644 index 0a7027de1..000000000 --- a/changelog_unreleased/javascript/pr-8461.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Wrap jsx element on the left of "<" with parentheses ([#8461](https://github.com/prettier/prettier/pull/8461) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - - -```jsx -// Input -(
) < 5; - -// Prettier stable -
< 5; - -// Prettier stable second outout -SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...? (1:9) -> 1 |
< 5; - | ^ - 2 | - -// Prettier master -(
) < 5; -``` diff --git a/changelog_unreleased/javascript/pr-8476.md b/changelog_unreleased/javascript/pr-8476.md deleted file mode 100644 index dddb4b851..000000000 --- a/changelog_unreleased/javascript/pr-8476.md +++ /dev/null @@ -1,20 +0,0 @@ -#### Fix indentation for binary expressions with trailing comments ([#8476](https://github.com/prettier/prettier/pull/8476) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - - -```js -// Input -a + - a + // comment - a; - -// Prettier stable -a + -a + // comment - a; - -// Prettier master -a + - a + // comment - a; - -``` diff --git a/changelog_unreleased/javascript/pr-8491.md b/changelog_unreleased/javascript/pr-8491.md deleted file mode 100644 index bbc8f13b1..000000000 --- a/changelog_unreleased/javascript/pr-8491.md +++ /dev/null @@ -1,61 +0,0 @@ -#### Fix unstable comments in binary expressions ([#8491](https://github.com/prettier/prettier/pull/8491) by [@thorn0](https://github.com/thorn0)) - - -```jsx -// Input -Math.min( - ( - /* foo */ - document.body.scrollHeight - - (window.scrollY + window.innerHeight) - ) - devsite_footer_height, - 0, -) - -// Prettier stable (first output) -Math.min( - /* foo */ - document.body.scrollHeight - - (window.scrollY + window.innerHeight) - - devsite_footer_height, - 0 -); - -// Prettier stable (second output) -Math.min( - /* foo */ - document.body.scrollHeight - - (window.scrollY + window.innerHeight) - - devsite_footer_height, - 0 -); - -// Prettier master (first and second outputs) -Math.min( - /* foo */ - document.body.scrollHeight - - (window.scrollY + window.innerHeight) - - devsite_footer_height, - 0 -); -``` - - -```jsx -// Input -const topOfDescriptionBox = - Layout.window.width + // Images are 1:1 aspect ratio, full screen width - Layout.headerHeight; - -// Prettier stable (first output) -const topOfDescriptionBox = - Layout.window.width + Layout.headerHeight; // Images are 1:1 aspect ratio, full screen width - -// Prettier stable (second output) -const topOfDescriptionBox = Layout.window.width + Layout.headerHeight; // Images are 1:1 aspect ratio, full screen width - -// Prettier master (first and second outputs) -const topOfDescriptionBox = - Layout.window.width + // Images are 1:1 aspect ratio, full screen width - Layout.headerHeight; -``` diff --git a/changelog_unreleased/javascript/pr-8508.md b/changelog_unreleased/javascript/pr-8508.md deleted file mode 100644 index 9f252faf6..000000000 --- a/changelog_unreleased/javascript/pr-8508.md +++ /dev/null @@ -1,44 +0,0 @@ -#### Quote and unquote number keys ([#8508](https://github.com/prettier/prettier/pull/8508) by [@lydell](https://github.com/lydell)) - -Prettier removes quotes from object keys if they are identifiers. Now, Prettier also removes quotes from object keys that are numbers. - -If you use `quoteProps: "consistent"`, Prettier can also _add_ quotes to number keys so that _all_ properties end up with quotes. - - -```jsx -// Input -x = { - "a": null, - "1": null, -}; - -// Prettier stable -x = { - a: null, - "1": null, -}; - -// Prettier master -x = { - a: null, - 1: null, -}; -``` - -Prettier only touches “simple” numbers such as `1` and `123.5`. It _won’t_ make the following transformations, as they feel unexpected: - -``` -1e2 -> "100" -0b10 -> "10" -1_000 -> "1000" -1.0 -> "1" -0.99999999999999999 -> "1" -999999999999999999999 -> "1e+21" -2n -> "2" - -"1e+100" -> 1e100 -``` - -(Please don’t use confusing numbers as object keys!) - -Note that Prettier only unquotes numbers using the `"babel"` parser. It’s not completely safe to do so in TypeScript. diff --git a/changelog_unreleased/javascript/pr-8557.md b/changelog_unreleased/javascript/pr-8557.md deleted file mode 100644 index c6c9dcbb4..000000000 --- a/changelog_unreleased/javascript/pr-8557.md +++ /dev/null @@ -1,22 +0,0 @@ -#### Prefer leading comment when there is a comment on after "?" in conditional types ([#8557](https://github.com/prettier/prettier/pull/8557) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - - -```ts -// Input -type A = B extends T - ? // comment - foo - : bar; - -// Prettier stable -type A = B extends T // comment - ? foo - : bar; - -// Prettier master -type A = B extends T - ? // comment - foo - : bar; - -``` diff --git a/changelog_unreleased/javascript/pr-8592.md b/changelog_unreleased/javascript/pr-8592.md deleted file mode 100644 index 55ef72011..000000000 --- a/changelog_unreleased/javascript/pr-8592.md +++ /dev/null @@ -1,26 +0,0 @@ -#### Break ternary expressions that include a multiline block comment ([#8592](https://github.com/prettier/prettier/pull/8592) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - - -```js -// Input -test - ? /* comment - comment - */ - foo - : bar; - -// Prettier stable -test ? /* comment - comment - */ foo : bar; - -// Prettier master -test - ? /* comment - comment - */ - foo - : bar; - -``` diff --git a/changelog_unreleased/javascript/pr-8731.md b/changelog_unreleased/javascript/pr-8731.md deleted file mode 100644 index 3daedd670..000000000 --- a/changelog_unreleased/javascript/pr-8731.md +++ /dev/null @@ -1,28 +0,0 @@ -#### Fix unstable pair of comments between class methods ([#8731](https://github.com/prettier/prettier/pull/8731) by [@fisker](https://github.com/fisker)) - - -```js -// Input -class C { - ma() {} /* D */ /* E */ - mb() {} -} - -// Prettier stable -class C { - ma() {} /* E */ /* D */ - mb() {} -} - -// Prettier stable (Second format) -class C { - ma() {} /* D */ /* E */ - mb() {} -} - -// Prettier master -class C { - ma() {} /* D */ /* E */ - mb() {} -} -``` diff --git a/changelog_unreleased/javascript/pr-8742.md b/changelog_unreleased/javascript/pr-8742.md deleted file mode 100644 index 99ac592c0..000000000 --- a/changelog_unreleased/javascript/pr-8742.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Fix duplicated `prettier-ignore` comments ([#8742](https://github.com/prettier/prettier/pull/8742) by [@fisker](https://github.com/fisker)) - - -```js -// Input -a =
-a =
- -// Prettier stable -a =
; -a =
; - -// Prettier master -a =
; -a =
; -``` diff --git a/changelog_unreleased/javascript/pr-8901.md b/changelog_unreleased/javascript/pr-8901.md deleted file mode 100644 index e27ba1633..000000000 --- a/changelog_unreleased/javascript/pr-8901.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Support Decimal Proposal ([#8901](https://github.com/prettier/prettier/pull/8901) by [@fisker](https://github.com/fisker)) - -Support Stage-1 proposal [Decimal Proposal](https://github.com/tc39/proposal-decimal). - - -```js -// Input -0.3m; - -// Prettier stable -SyntaxError: Identifier directly after number (1:4) -> 1 | 0.3m; - -// Prettier master -0.3m; -``` diff --git a/changelog_unreleased/javascript/pr-9011.md b/changelog_unreleased/javascript/pr-9011.md deleted file mode 100644 index e24709f5e..000000000 --- a/changelog_unreleased/javascript/pr-9011.md +++ /dev/null @@ -1,21 +0,0 @@ -#### Add parens when yielding jsx ([#9011](https://github.com/prettier/prettier/pull/9011) by [@fisker](https://github.com/fisker)) - -In `v2.0.0` we [removed the parens when yielding jsx](https://prettier.io/blog/2020/03/21/2.0.0.html#remove-unnecessary-parens-when-yielding-jsx-7367httpsgithubcomprettierprettierpull7367-by-cola119httpsgithubcomcola119), this works for most parsers, but ESLint throws when parsing it, [related issue](https://github.com/acornjs/acorn-jsx/issues/82). - - -```js -// Input -function* f() { - yield
generator
-} - -// Prettier stable -function* f() { - yield
generator
-} - -// Prettier master -function* f() { - yield (
generator
); -} -``` diff --git a/changelog_unreleased/less/pr-8178.md b/changelog_unreleased/less/pr-8178.md deleted file mode 100644 index 1117386df..000000000 --- a/changelog_unreleased/less/pr-8178.md +++ /dev/null @@ -1,20 +0,0 @@ -#### Fix `:extend` pseudo-class ([#8178](https://github.com/prettier/prettier/pull/8178) by [@fisker](https://github.com/fisker)) - -The selector is parsed as value before, now it's recognized as selector. - - -```less -// Input -.hello { - &:extend(.input[type="checkbox"]:checked ~ label)} - -// Prettier stable -.hello { - &:extend(.input[type= "checkbox" ]: checked ~label); -} - -// Prettier master -.hello { - &:extend(.input[type="checkbox"]:checked ~ label); -} -``` diff --git a/changelog_unreleased/less/pr-8360.md b/changelog_unreleased/less/pr-8360.md deleted file mode 100644 index 0d967d359..000000000 --- a/changelog_unreleased/less/pr-8360.md +++ /dev/null @@ -1,35 +0,0 @@ -#### Fix inline comments contains `/*` ([#8360](https://github.com/prettier/prettier/pull/8360) by [@fisker](https://github.com/fisker)) - -When inline comments contains `/*`, some other comment not correctly printed. - - -```less -// Input -@import "a"; - -// '/*' <-- this breaks formatting - -@import 'b'; -/* block */ -/*no-space block*/ - -// Prettier stable -@import "a"; - -// '/*' <-- this breaks formatting - -@import "b"; - -@import 'b -@import 'b'; -/* bl - -// Prettier master -@import "a"; - -// '/*' <-- this breaks formatting - -@import "b"; -/* block */ -/*no-space block*/ -``` diff --git a/changelog_unreleased/markdown/pr-8140.md b/changelog_unreleased/markdown/pr-8140.md deleted file mode 100644 index df01c8549..000000000 --- a/changelog_unreleased/markdown/pr-8140.md +++ /dev/null @@ -1,5 +0,0 @@ -#### Update `remark-parse` to v8 ([#8140](https://github.com/prettier/prettier/pull/8140) by [@saramarcondes](https://github.com/saramarcondes), [@fisker](https://github.com/fisker), [@thorn0](https://github.com/thorn0)) - -[remark](https://remark.js.org/), the Markdown parser that Prettier uses, got a long-overdue update (5.0.0 → 8.0.2, see [remark's changelog](https://github.com/remarkjs/remark/releases)). This fixed tons of old bugs, in particular related to parsing list items indented with tabs. - -Please note that the new version is stricter in parsing footnotes, a syntax extension not defined in any specification. Previously, Prettier would parse (and output, depending on the `--tab-width` option) multiline footnotes indented with any number of spaces. The new version recognizes only multiline footnotes indented with 4 spaces. This change isn't considered breaking as the syntax is non-standard, but if you happen to use it, before updating Prettier, you might want to use its older version with `--tab-width=4` to make footnotes in your files compatible with the new version. diff --git a/changelog_unreleased/markdown/pr-8511.md b/changelog_unreleased/markdown/pr-8511.md deleted file mode 100644 index 3b2bf3ada..000000000 --- a/changelog_unreleased/markdown/pr-8511.md +++ /dev/null @@ -1,13 +0,0 @@ -#### Correctly format CJK sentences with Variation Selector ([#8511](https://github.com/prettier/prettier/pull/8511) by [@ne-sachirou](https://github.com/ne-sachirou)) - - -```markdown - -麻󠄁羽󠄀‼️ - - -麻 󠄁 羽 󠄀 ‼️ - - -麻󠄁羽󠄀‼️ -``` diff --git a/changelog_unreleased/scss/pr-8366.md b/changelog_unreleased/scss/pr-8366.md deleted file mode 100644 index 8d1cdb163..000000000 --- a/changelog_unreleased/scss/pr-8366.md +++ /dev/null @@ -1,21 +0,0 @@ -#### Fix inline comments between property and value ([#8366](https://github.com/prettier/prettier/pull/8366) by [@fisker](https://github.com/fisker)) - - -```scss -// Input -a { - color: // comment - red; -} - -// Prettier stable -a { - color: // comment red; -} - -// Prettier master -a { - color: // comment - red; -} -``` diff --git a/changelog_unreleased/scss/pr-8675.md b/changelog_unreleased/scss/pr-8675.md deleted file mode 100644 index 971493fa4..000000000 --- a/changelog_unreleased/scss/pr-8675.md +++ /dev/null @@ -1,31 +0,0 @@ -#### Comments at the end of the file were lost if the final semicolon was omitted ([#8675](https://github.com/prettier/prettier/pull/8675) by [@fisker](https://github.com/fisker)) - - -```scss -// Input -@mixin foo() { - a { - color: #f99; - } -} - -@include foo() /* comment*/ - -// Prettier stable -@mixin foo() { - a { - color: #f99; - } -} - -@include foo(); - -// Prettier master -@mixin foo() { - a { - color: #f99; - } -} - -@include foo(); /* comment*/ -``` diff --git a/changelog_unreleased/typescript/pr-8046.md b/changelog_unreleased/typescript/pr-8046.md deleted file mode 100644 index 0b19f0bb9..000000000 --- a/changelog_unreleased/typescript/pr-8046.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Fix the `babel-ts` parser so that it emits a proper syntax error for `(a:b)` ([#8046](https://github.com/prettier/prettier/pull/8046) by [@thorn0](https://github.com/thorn0)) - -Previously, such code was parsed without errors, but an error was thrown in the printer, and this error was printed in an unfriendly way, with a stack trace. Now a proper syntax error is thrown by the parser. - - -```jsx -// Input -(a:b) - -// Prettier stable -[error] test.ts: Error: unknown type: "TSTypeCastExpression" -[error] ... [a long stack trace here] ... - -// Prettier master -[error] test.ts: SyntaxError: Did not expect a type annotation here. (1:2) -[error] > 1 | (a:b) -[error] | ^ -[error] 2 | -``` diff --git a/changelog_unreleased/typescript/pr-8422.md b/changelog_unreleased/typescript/pr-8422.md deleted file mode 100644 index 2f8d05a17..000000000 --- a/changelog_unreleased/typescript/pr-8422.md +++ /dev/null @@ -1,23 +0,0 @@ -#### Parenthesize string literals to avoid interpreting as directives ([#8422](https://github.com/prettier/prettier/pull/8422) by [@thorn0](https://github.com/thorn0)) - -Prettier wraps any string literal which is in statement position in parentheses because otherwise such strings would get interpreted as directives if they occurred at the top of a function or program, which can change the behavior of the program. It is not technically necessary to do this for strings which are not on the first line of a function or program. But doing so anyway is more consistent and can highlight bugs. See for example [this thread on twitter](https://twitter.com/dan_abramov/status/874601179334017024). - -Previously this didn't consistently work for the `typescript` parser. Only strings already wrapped in parentheses retained them. - - -```ts -// Input -f(); -'use foo'; -('use bar'); - -// Prettier stable -f(); -"use foo"; -("use bar"); - -// Prettier master -f(); -("use foo"); -("use bar"); -``` diff --git a/changelog_unreleased/typescript/pr-8450.md b/changelog_unreleased/typescript/pr-8450.md deleted file mode 100644 index e265812b2..000000000 --- a/changelog_unreleased/typescript/pr-8450.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Support TypeScript 3.9 breaking change for Optional Chaining and Non-Null Assertions ([#8450](https://github.com/prettier/prettier/pull/8450) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - -See https://devblogs.microsoft.com/typescript/announcing-typescript-3-9/#breaking-changes - - -```ts -// Input -(a?.b)!.c; - -// Prettier stable -a?.b!.c; - -// Prettier master -(a?.b)!.c; - -``` diff --git a/changelog_unreleased/typescript/pr-8805.md b/changelog_unreleased/typescript/pr-8805.md deleted file mode 100644 index 5c5784b48..000000000 --- a/changelog_unreleased/typescript/pr-8805.md +++ /dev/null @@ -1,15 +0,0 @@ -#### Support type annotations on catch clauses ([#8805](https://github.com/prettier/prettier/pull/8805) by [@fisker](https://github.com/fisker)) - - -```ts -// Input -try {} catch (e: any) {} - -// Prettier stable -try { -} catch (e) {} - -// Prettier master -try { -} catch (e: any) {} -``` diff --git a/changelog_unreleased/typescript/pr-8885.md b/changelog_unreleased/typescript/pr-8885.md deleted file mode 100644 index 190f475ae..000000000 --- a/changelog_unreleased/typescript/pr-8885.md +++ /dev/null @@ -1,16 +0,0 @@ -#### Support `Labeled Tuple Elements` ([#8885](https://github.com/prettier/prettier/pull/8885) by [@fisker](https://github.com/fisker), [#8982](https://github.com/prettier/prettier/pull/8982) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - -[`Labeled Tuple Elements`](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0-beta/#labeled-tuple-elements) - - -```ts -// Input -type Range = [start: number, end: number]; - -// Prettier stable -SyntaxError: Unexpected token, expected "," (1:20) -> 1 | type Range = [start: number, end: number]; - -// Prettier master -type Range = [start: number, end: number]; -``` diff --git a/changelog_unreleased/vue/pr-8023.md b/changelog_unreleased/vue/pr-8023.md deleted file mode 100644 index 0d3500ab5..000000000 --- a/changelog_unreleased/vue/pr-8023.md +++ /dev/null @@ -1,36 +0,0 @@ -#### Improve formatting Vue SFC root blocks ([#8023](https://github.com/prettier/prettier/pull/8023) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#8465](https://github.com/prettier/prettier/pull/8465) by [@fisker](https://github.com/fisker)) - -Support formatting all [language blocks](https://vue-loader.vuejs.org/spec.html#language-blocks)(including [custom blocks](https://vue-loader.vuejs.org/spec.html#custom-blocks) with `lang` attribute) with [builtin parsers](https://prettier.io/docs/en/options.html#parser) and [plugins](https://prettier.io/docs/en/plugins.html). - - -```html - - - -{ -"hello": 'prettier',} - - - - - -{ -"hello": 'prettier',} - - - - - -{ - "hello": "prettier" -} - -``` - -**[@prettier/plugin-pug](https://github.com/prettier/plugin-pug) is required for this example.** diff --git a/changelog_unreleased/vue/pr-8153.md b/changelog_unreleased/vue/pr-8153.md deleted file mode 100644 index cbbe60818..000000000 --- a/changelog_unreleased/vue/pr-8153.md +++ /dev/null @@ -1,21 +0,0 @@ -#### Improve parsing for custom blocks ([#8153](https://github.com/prettier/prettier/pull/8153) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - - -```html - - -const foo = " - - -SyntaxError: Unexpected character """ (2:19) -[error] 1 | -[error] > 2 | const foo = " - - - -const foo = " -``` diff --git a/changelog_unreleased/vue/pr-8280.md b/changelog_unreleased/vue/pr-8280.md deleted file mode 100644 index eb13b15e1..000000000 --- a/changelog_unreleased/vue/pr-8280.md +++ /dev/null @@ -1,13 +0,0 @@ -#### Fix broken format with upper case HTML tag ([#8280](https://github.com/prettier/prettier/pull/8280) by [@fisker](https://github.com/fisker)) - - -```html - - - - -> - - - -``` diff --git a/changelog_unreleased/vue/pr-8325.md b/changelog_unreleased/vue/pr-8325.md deleted file mode 100644 index bf51996cb..000000000 --- a/changelog_unreleased/vue/pr-8325.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Fix ugly formatting for one line `template` in Vue SFC ([#8325](https://github.com/prettier/prettier/pull/8325) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - - -```html - - - - - - - - -``` diff --git a/changelog_unreleased/vue/pr-8326.md b/changelog_unreleased/vue/pr-8326.md deleted file mode 100644 index d9c492e22..000000000 --- a/changelog_unreleased/vue/pr-8326.md +++ /dev/null @@ -1,62 +0,0 @@ -#### Support Vue DOM Template ([#8326](https://github.com/prettier/prettier/pull/8326) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - -When use vue parse for HTML, parse template as HTML. - - -```html - - - - -
-
First Line
Second Line
-
- - - - - - - - - -
First Line
Second Line
- - - - - - - - - -
-
First Line
-
Second Line
-
- - - - -``` diff --git a/changelog_unreleased/vue/pr-8337.md b/changelog_unreleased/vue/pr-8337.md deleted file mode 100644 index 104253dc1..000000000 --- a/changelog_unreleased/vue/pr-8337.md +++ /dev/null @@ -1,40 +0,0 @@ -#### Improve upper case HTML tag formatting in DOM template ([#8337](https://github.com/prettier/prettier/pull/8337) by [@sosukesuzuki](https://github.com/sosukesuzuki)) - - -```html - - - -
- -
- - - - - - - - -
- -
- - - - - - - - -
- - - -``` diff --git a/changelog_unreleased/vue/pr-8747.md b/changelog_unreleased/vue/pr-8747.md deleted file mode 100644 index 8e6449c51..000000000 --- a/changelog_unreleased/vue/pr-8747.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Fix parenthesized interpolation format ([#8747](https://github.com/prettier/prettier/pull/8747) by [@fisker](https://github.com/fisker)) - - -```vue - - - - - - - - -``` diff --git a/changelog_unreleased/vue/pr-8839.md b/changelog_unreleased/vue/pr-8839.md deleted file mode 100644 index 85d36b538..000000000 --- a/changelog_unreleased/vue/pr-8839.md +++ /dev/null @@ -1,19 +0,0 @@ -#### Fix named slots shorthand value is not formatted ([#8839](https://github.com/prettier/prettier/pull/8839) by [@wenfangdu](https://github.com/wenfangdu)) - - -```vue - - - - - - - - -``` diff --git a/changelog_unreleased/yaml/pr-8355.md b/changelog_unreleased/yaml/pr-8355.md deleted file mode 100644 index 215b7d69d..000000000 --- a/changelog_unreleased/yaml/pr-8355.md +++ /dev/null @@ -1,34 +0,0 @@ -#### Fix unstable format with `prettier-ignore` ([#8355](https://github.com/prettier/prettier/pull/8355) by [@fisker](https://github.com/fisker)) - - -```yaml -# Input -# prettier-ignore ---- -prettier: true -... -hello: world - -# Prettier stable -# prettier-ignore ---- -prettier: true ---- -hello: world - -# Prettier stable (Second format) -# prettier-ignore ---- -prettier: true - ---- -hello: world - -# Prettier master -# prettier-ignore ---- -prettier: true ---- -hello: world - -``` diff --git a/changelog_unreleased/yaml/pr-8356.md b/changelog_unreleased/yaml/pr-8356.md deleted file mode 100644 index 39391e28b..000000000 --- a/changelog_unreleased/yaml/pr-8356.md +++ /dev/null @@ -1,54 +0,0 @@ -#### Preserve blank lines in comments ([#8356](https://github.com/prettier/prettier/pull/8356) by [@fisker](https://github.com/fisker)) - - -```yaml -# Input -a: - - a: a - - # - b: b - - # - c: c - - - d: d - - -b: - - a: a - - # - b: b - - # - c: c - -# Prettier stable -a: - - a: a - - # - b: b - - # - c: c - - - d: d - -b: - - a: a - # - b: b - # - c: c - -# Prettier master -a: - - a: a - - # - b: b - - # - c: c - - - d: d - -b: - - a: a - - # - b: b - - # - c: c -``` diff --git a/changelog_unreleased/yaml/pr-8386.md b/changelog_unreleased/yaml/pr-8386.md deleted file mode 100644 index 7147a731f..000000000 --- a/changelog_unreleased/yaml/pr-8386.md +++ /dev/null @@ -1,35 +0,0 @@ -#### Update `yaml` and `yaml-unist-parser` ([#8386](https://github.com/prettier/prettier/pull/8386) by [@fisker](https://github.com/fisker), fixes in [`yaml-unist-parser`](https://github.com/ikatyang/yaml-unist-parser) by [@ikatyang](https://github.com/ikatyang)) - -- `yaml`: [Add explicit error for block scalars with more-indented leading empty lines](https://github.com/eemeli/yaml/commit/7eafeb821d4a89d4de26f5b3798ee6e009e99b12) -- `yaml-unist-parser`: [fix: no false positive for document head end marker position](https://github.com/ikatyang/yaml-unist-parser/pull/272) - - -```yaml -# Input -# --- comments --- - -# Prettier stable ---- # --- comments --- - -# Prettier master -# --- comments --- - -# Input -empty block scalar: > - - # comment - -# Prettier stable -empty block scalar: > - -# comment - -# Prettier master -SyntaxError: Block scalars with more-indented leading empty lines must use an explicit indentation indicator (1:21) -> 1 | empty block scalar: > - | ^ -> 2 | - | ^^ -> 3 | # comment - | ^^^^^^^^^^^ -``` diff --git a/changelog_unreleased/yaml/pr-8888.md b/changelog_unreleased/yaml/pr-8888.md deleted file mode 100644 index 9301b0336..000000000 --- a/changelog_unreleased/yaml/pr-8888.md +++ /dev/null @@ -1,39 +0,0 @@ -#### Fix error on YAML Inline Extend syntax ([#8888](https://github.com/prettier/prettier/pull/8888) by [@fisker](https://github.com/fisker), [@evilebottnawi](https://github.com/evilebottnawi), fixes in [`yaml-unist-parser`](https://github.com/ikatyang/yaml-unist-parser) by [@ikatyang](https://github.com/ikatyang)) - - -```yaml -# Input -foo: - <<: &anchor - K1: "One" - K2: "Two" - -bar: - <<: *anchor - K3: "Three" - -# Prettier stable -SyntaxError: Merge nodes can only have Alias nodes as values (2:2) - 1 | foo: -> 2 | <<: &anchor - | ^^^^^^^^^^^ -> 3 | K1: "One" - | ^^^^^^^^^^^^ -> 4 | K2: "Two" - | ^^^^^^^^^^^^ -> 5 | - | ^ - 6 | bar: - 7 | <<: *anchor - 8 | K3: "Three" - -# Prettier master -foo: - <<: &anchor - K1: "One" - K2: "Two" - -bar: - <<: *anchor - K3: "Three" -``` diff --git a/cspell.json b/cspell.json index 9c50df1d0..c74e75d43 100644 --- a/cspell.json +++ b/cspell.json @@ -117,7 +117,6 @@ "Filipe", "finalizer", "Fiorini", - "fisker", "fnames", "foldgutter", "formatprg", @@ -403,7 +402,10 @@ "\\[`\\w+`\\]", "ve{2,}r{2,}y", "ve+r+y+long\\w*", - "\\/.*?\\/" + "\\/.*?\\/", + "author: \".*?\"", + "authorURL: \".*?\"", + "\"author\": \".*?\"" ], "ignorePaths": [ "cspell.json", diff --git a/website/blog/2020-08-24-2.1.0.md b/website/blog/2020-08-24-2.1.0.md new file mode 100644 index 000000000..0086b607f --- /dev/null +++ b/website/blog/2020-08-24-2.1.0.md @@ -0,0 +1,2320 @@ +--- +author: "Sosuke Suzuki (@sosukesuzuki)" +authorURL: "https://github.com/sosukesuzuki" +title: "Prettier 2.1: new --embedded-language-formatting option and new JavaScript/TypeScript features!" +--- + +This release adds a new `--embedded-language-formatting` option, supports new JavaScript/TypeScript features, and includes many bug fixes and improvements! + + + +## Highlights + +### API + +#### Add --embedded-language-formatting={auto,off} option ([#7875](https://github.com/prettier/prettier/pull/7875) by [@bakkot](https://github.com/bakkot), [#8825](https://github.com/prettier/prettier/pull/8825) by [@fisker](https://github.com/fiskers)) + +When Prettier identifies cases where it looks like you've placed some code it knows how to format within a string in another file, like in a tagged template in JavaScript with a tag named `html` or in code blocks in Markdown, it will try to format that code by default. + +Sometimes this behavior is undesirable, since it can change the behavior of your code. This option allows you to switch between the default behavior (`auto`) and disabling this feature entirely (`off`). It applies to all languages where Prettier recognizes embedded code, not just JavaScript. + + +```js +// Input +html` +

+I am expecting this to come out exactly like it went in. +`; + +// using --embedded-language-formatting=auto (or omitting this option) +html` +

+ I am expecting this to come out exactly like it went in. +

+`; + +// using --embedded-language-formatting=off +html` +

+I am expecting this to come out exactly like it went in. +`; +``` + +### TypeScript + +#### Support for TypeScript 4.0 + +- [Labeled Tuple Elements](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#labeled-tuple-elements) +- [Short-Circuiting Assignment Operators](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#short-circuiting-assignment-operators) +- [Type annotations on catch clauses](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#unknown-on-catch) + +##### Labeled Tuple Elements ([#8885](https://github.com/prettier/prettier/pull/8885) by [@fisker](https://github.com/fisker), [#8982](https://github.com/prettier/prettier/pull/8982) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```ts +// Input +type Range = [start: number, end: number]; + +// Prettier 2.0 +SyntaxError: Unexpected token, expected "," (1:20) +> 1 | type Range = [start: number, end: number]; + +// Prettier 2.1 +type Range = [start: number, end: number]; +``` + +##### Short-Circuiting Assignment Operators ([#8982](https://github.com/prettier/prettier/pull/8982) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```ts +// Input +a ||= b; + +// Prettier 2.0 +SyntaxError: Expression expected. (1:5) +> 1 | a ||= b; + +// Prettier 2.1 +a ||= b; +``` + +##### Type annotations on catch clauses ([#8805](https://github.com/prettier/prettier/pull/8805) by [@fisker](https://github.com/fisker)) + + +```ts +// Input +try {} catch (e: any) {} + +// Prettier 2.0 +try { +} catch (e) {} + +// Prettier 2.1 +try { +} catch (e: any) {} +``` + +## Other changes + +### JavaScript + +#### Support the F# and Smart pipeline operator proposals ([#6319](https://github.com/prettier/prettier/pull/6319) by [@sosukesuzuki](https://github.com/sosukesuzuki), [@thorn0](https://github.com/thorn0), [#7979](https://github.com/prettier/prettier/pull/7979) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +- [F# Pipeline Operator proposal](https://github.com/valtech-nyc/proposal-fsharp-pipelines) +- [Smart Pipelines proposal](https://github.com/js-choi/proposal-smart-pipelines) +- [Babel Blog: What's Happening With the Pipeline (`|>`) Proposal?](https://babeljs.io/blog/2018/07/19/whats-happening-with-the-pipeline-proposal) + +**F#-style Pipeline:** + + +```js +// Input +promises |> await; + +// Output (Prettier 2.0) +SyntaxError: Unexpected token (1:18) +> 1 | promises |> await; + | ^ + +// Output (Prettier 2.1) +promises |> await; +``` + +**Smart Pipeline:** + + +```js +// Input +5 |> # * 2 + +// Output (Prettier 2.0) +SyntaxError: Unexpected character '#' (1:6) +> 1 | 5 |> # * 2 + | ^ + +// Output (Prettier 2.1) +5 |> # * 2 +``` + +#### Fix end-of-line comments if followed by trailing whitespace ([#8069](https://github.com/prettier/prettier/pull/8069) by [@shisama](https://github.com/shisama)) + +If a comments line had trailing whitespaces, comments were not detected as end-of-line. + + +```jsx +// Input +var a = { /* extra whitespace --> */ + b }; + +var a = { /* no whitespace --> */ + b }; + +// Prettier 2.0 +var a = { + /* extra whitespace --> */ + + b, +}; + +var a = { + /* no whitespace --> */ b, +}; + +// Prettier 2.1 +var a = { + /* extra whitespace --> */ b, +}; + +var a = { + /* no whitespace --> */ b, +}; +``` + +#### Fix inconsistent parsing of injected expressions in styled-components template literals ([#8097](https://github.com/prettier/prettier/pull/8097) by [@thecodrr](https://github.com/thecodrr)) + + +```js +// Input +const SingleConcat = styled.div` + ${something()} + & > ${Child}:not(:first-child) { +margin-left:5px; +} +` + +const MultiConcats = styled.div` + ${something()} + & > ${Child}${Child2}:not(:first-child) { +margin-left:5px; +} +` + +const SeparatedConcats = styled.div` +font-family: "${a}", "${b}"; +` + +// Prettier 2.0 -- same as input + +// Prettier 2.1 +const SingleConcat = styled.div` + ${something()} + & > ${Child}:not(:first-child) { + margin-left: 5px; + } +`; + +const MultiConcats = styled.div` + ${something()} + & > ${Child}${Child2}:not(:first-child) { + margin-left: 5px; + } +`; + +const SeparatedConcats = styled.div` + font-family: "${a}", "${b}"; +`; +``` + +#### Fix object trailing commas that last property is ignored ([#8111](https://github.com/prettier/prettier/pull/8111) by [@fisker](https://github.com/fisker)) + + +```js +// Input +const foo = { + // prettier-ignore + bar: "baz" +} + +// Prettier 2.0 +const foo = { + // prettier-ignore + bar: "baz" +}; + +// Prettier 2.1 +const foo = { + // prettier-ignore + bar: "baz", +}; +``` + +#### Keep object key with escape sequence as it is ([#8160](https://github.com/prettier/prettier/pull/8160) by [@fisker](https://github.com/fisker)) + + +```js +// Input +const a = { + "\u2139": 'why "\\u2139" converted to "i"?', +}; + +// Prettier 2.0 +const a = { + ℹ: 'why "\\u2139" converted to "i"?', +}; + + +// Prettier 2.1 +const a = { + "\u2139": 'why "\\u2139" is converted to "i"?', +}; +``` + +#### Fix extra space after minus in CSS-in-JS ([#8255](https://github.com/prettier/prettier/pull/8255) by [@thorn0](https://github.com/thorn0)) + + +```js +// Input +css` +color: var(--global--color--${props.color}); +` + +// Prettier 2.0 +css` + color: var(--global--color-- ${props.color}); +`; + +// Prettier 2.1 +css` + color: var(--global--color--${props.color}); +`; +``` + +#### Fix comments in the `extends` part of class declarations/expressions ([#8312](https://github.com/prettier/prettier/pull/8312) by [@thorn0](https://github.com/thorn0)) + + +```jsx +// Input +class a extends a // comment +{ + constructor() {} +} + +// Prettier 2.0 +class a extends a // comment { + constructor() {} +} + +// Prettier 2.1 +class a extends a { // comment + constructor() {} +} +``` + +#### Don't wrap arrays in Jest `test.each` template strings ([#8354](https://github.com/prettier/prettier/pull/8354) by [@yogmel](https://github.com/yogmel)) + + +```jsx +// Input +test.each` +a | b | c +${1} | ${[{ start: 1, end: 3 },{ start: 15, end: 20 },]} | ${[]} +`("example test", ({a, b, c}) => {}) + +// Prettier 2.0 +test.each` + a | b | c + ${1} | ${[ + { start: 1, end: 3 }, + { start: 15, end: 20 } +]} | ${[]} +`("example test", ({ a, b, c }) => {}); + +// Prettier 2.1 +test.each` + a | b | c + ${1} | ${[{ start: 1, end: 3 }, { start: 15, end: 20 }]} | ${[]} +`("example test", ({ a, b, c }) => {}); +``` + +#### Support `insertPragma` and `requirePragma` in files with shebang ([#8376](https://github.com/prettier/prettier/pull/8376) by [@fisker](https://github.com/fisker)) + + +```js +// `--insert-pragma` +// Input +#!/usr/bin/env node +hello + .world(); + +// Prettier 2.0 +SyntaxError: Unexpected token (3:1) + 1 | /** @format */ + 2 | +> 3 | #!/usr/bin/env node + | ^ + 4 | hello + 5 | .world(); + +// Prettier 2.1 +#!/usr/bin/env node +/** @format */ + +hello.world(); + +// `--require-pragma` +// Input +#!/usr/bin/env node +/** + * @format + */ +hello + .world(); + +// Prettier 2.0 +#!/usr/bin/env node +/** + * @format + */ +hello + .world(); + +// Prettier 2.1 +#!/usr/bin/env node +/** + * @format + */ +hello.world(); +``` + +#### Fix range formatting indentation ([#8410](https://github.com/prettier/prettier/pull/8410) by [@thorn0](https://github.com/thorn0)) + +```console +> echo -e "export default class Foo{\n/**/\n}" | prettier --range-start 16 --range-end 31 --parser babel +``` + + +```js +// Prettier 2.0 +export default class Foo { + /**/ + } + +// Prettier 2.1 +export default class Foo { + /**/ +} +``` + +#### Improve detection of source elements for range formatting ([#8419](https://github.com/prettier/prettier/pull/8419) by [@thorn0](https://github.com/thorn0)) + +Not all statement types were detected (read [here](https://prettier.io/docs/en/options.html#range) how range formatting works in Prettier). + + +```jsx +// Input +for (const element of list) { /* ... */ } +// ^^^^^^^^^^^^^^^^^^^^^^ ← range + +// Prettier 2.0 +for (const element of list) { /* ... */ } + +// Prettier 2.1 +for (const element of list) { + /* ... */ +} +``` + +#### Support Private Fields in `in` ([#8431](https://github.com/prettier/prettier/pull/8431) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +Support Stage-2 proposal [Private Fields in `in`](https://github.com/tc39/proposal-private-fields-in-in/blob/master/README.md). + + +```js +// Input +#prop in obj; + +// Prettier 2.0 +SyntaxError: Unexpected token (1:1) +> 1 | #prop in obj; + | ^ + 2 | + +// Prettier 2.1 +#prop in obj; +``` + +#### Support ES Module Attributes and JSON modules ([#8436](https://github.com/prettier/prettier/pull/8436) by [@fisker](https://github.com/fisker)) + +Support Stage-1 proposal [ES Module Attributes and JSON modules](https://github.com/tc39/proposal-module-attributes). + + +```js +// Input +import foo from "foo.json" with type: "json"; + +// Prettier 2.0 +SyntaxError: Unexpected token, expected ";" (1:28) +> 1 | import foo from "foo.json" with type: "json"; + | ^ + +// Prettier 2.1 +import foo from "foo.json" with type: "json"; +``` + +#### Support record and tuple syntax ([#8453](https://github.com/prettier/prettier/pull/8453) by [@fisker](https://github.com/fisker)) + +Support Stage-1 proposal [JavaScript Records & Tuples Proposal](https://github.com/tc39/proposal-record-tuple/blob/master/README.md). + +_Only support `#[]`/`#{}` syntax, not `{| |}` / `[| |]`._ + +**Tuples** + + +```js +// Input +#[1, 2, 3] + +// Prettier 2.0 +SyntaxError: Unexpected token (1:1) +> 1 | #[1, 2, 3] + | ^ + + +// Prettier 2.1 +#[1, 2, 3]; +``` + +**Records** + + +```js +// Input +#{ + a: 1, + b: 2, + c: 3, +} + +// Prettier 2.0 +SyntaxError: Unexpected token (1:1) +> 1 | #{ + | ^ + 2 | a: 1, + 3 | b: 2, + 4 | c: 3, + + +// Prettier 2.1 +#{ + a: 1, + b: 2, + c: 3, +}; +``` + +#### Wrap jsx element on the left of "<" with parentheses ([#8461](https://github.com/prettier/prettier/pull/8461) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```jsx +// Input +(

) < 5; + +// Prettier 2.0 +
< 5; + +// Prettier 2.0 second outout +SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...? (1:9) +> 1 |
< 5; + | ^ + 2 | + +// Prettier 2.1 +(
) < 5; +``` + +#### Fix indentation for binary expressions with trailing comments ([#8476](https://github.com/prettier/prettier/pull/8476) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```js +// Input +a + + a + // comment + a; + +// Prettier 2.0 +a + +a + // comment + a; + +// Prettier 2.1 +a + + a + // comment + a; + +``` + +#### Fix unstable comments in binary expressions ([#8491](https://github.com/prettier/prettier/pull/8491) by [@thorn0](https://github.com/thorn0)) + + +```jsx +// Input +Math.min( + ( + /* foo */ + document.body.scrollHeight - + (window.scrollY + window.innerHeight) + ) - devsite_footer_height, + 0, +) + +// Prettier 2.0 (first output) +Math.min( + /* foo */ + document.body.scrollHeight - + (window.scrollY + window.innerHeight) - + devsite_footer_height, + 0 +); + +// Prettier 2.0 (second output) +Math.min( + /* foo */ + document.body.scrollHeight - + (window.scrollY + window.innerHeight) - + devsite_footer_height, + 0 +); + +// Prettier 2.1 (first and second outputs) +Math.min( + /* foo */ + document.body.scrollHeight - + (window.scrollY + window.innerHeight) - + devsite_footer_height, + 0 +); +``` + + +```jsx +// Input +const topOfDescriptionBox = + Layout.window.width + // Images are 1:1 aspect ratio, full screen width + Layout.headerHeight; + +// Prettier 2.0 (first output) +const topOfDescriptionBox = + Layout.window.width + Layout.headerHeight; // Images are 1:1 aspect ratio, full screen width + +// Prettier 2.0 (second output) +const topOfDescriptionBox = Layout.window.width + Layout.headerHeight; // Images are 1:1 aspect ratio, full screen width + +// Prettier 2.1 (first and second outputs) +const topOfDescriptionBox = + Layout.window.width + // Images are 1:1 aspect ratio, full screen width + Layout.headerHeight; +``` + +#### Quote and unquote number keys ([#8508](https://github.com/prettier/prettier/pull/8508) by [@lydell](https://github.com/lydell)) + +Prettier removes quotes from object keys if they are identifiers. Now, Prettier also removes quotes from object keys that are numbers. + +If you use `quoteProps: "consistent"`, Prettier can also _add_ quotes to number keys so that _all_ properties end up with quotes. + + +```jsx +// Input +x = { + "a": null, + "1": null, +}; + +// Prettier 2.0 +x = { + a: null, + "1": null, +}; + +// Prettier 2.1 +x = { + a: null, + 1: null, +}; +``` + +Prettier only touches “simple” numbers such as `1` and `123.5`. It _won’t_ make the following transformations, as they feel unexpected: + +``` +1e2 -> "100" +0b10 -> "10" +1_000 -> "1000" +1.0 -> "1" +0.99999999999999999 -> "1" +999999999999999999999 -> "1e+21" +2n -> "2" + +"1e+100" -> 1e100 +``` + +(Please don’t use confusing numbers as object keys!) + +Note that Prettier only unquotes numbers using the `"babel"` parser. It’s not completely safe to do so in TypeScript. + +#### Prefer leading comment when there is a comment on after "?" in conditional types ([#8557](https://github.com/prettier/prettier/pull/8557) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```ts +// Input +type A = B extends T + ? // comment + foo + : bar; + +// Prettier 2.0 +type A = B extends T // comment + ? foo + : bar; + +// Prettier 2.1 +type A = B extends T + ? // comment + foo + : bar; + +``` + +#### Break ternary expressions that include a multiline block comment ([#8592](https://github.com/prettier/prettier/pull/8592) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```js +// Input +test + ? /* comment + comment + */ + foo + : bar; + +// Prettier 2.0 +test ? /* comment + comment + */ foo : bar; + +// Prettier 2.1 +test + ? /* comment + comment + */ + foo + : bar; + +``` + +#### Fix unstable pair of comments between class methods ([#8731](https://github.com/prettier/prettier/pull/8731) by [@fisker](https://github.com/fisker)) + + +```js +// Input +class C { + ma() {} /* D */ /* E */ + mb() {} +} + +// Prettier 2.0 +class C { + ma() {} /* E */ /* D */ + mb() {} +} + +// Prettier 2.0 (Second format) +class C { + ma() {} /* D */ /* E */ + mb() {} +} + +// Prettier 2.1 +class C { + ma() {} /* D */ /* E */ + mb() {} +} +``` + +#### Fix duplicated `prettier-ignore` comments ([#8742](https://github.com/prettier/prettier/pull/8742) by [@fisker](https://github.com/fisker)) + + +```js +// Input +a =
+a =
+ +// Prettier 2.0 +a =
; +a =
; + +// Prettier 2.1 +a =
; +a =
; +``` + +#### Support Decimal Proposal ([#8901](https://github.com/prettier/prettier/pull/8901) by [@fisker](https://github.com/fisker)) + +Support Stage-1 proposal [Decimal Proposal](https://github.com/tc39/proposal-decimal). + + +```js +// Input +0.3m; + +// Prettier 2.0 +SyntaxError: Identifier directly after number (1:4) +> 1 | 0.3m; + +// Prettier 2.1 +0.3m; +``` + +#### Add parens when yielding jsx ([#9011](https://github.com/prettier/prettier/pull/9011) by [@fisker](https://github.com/fisker)) + +In `v2.0.0` we [removed the parens when yielding jsx](https://prettier.io/blog/2020/03/21/2.0.0.html#remove-unnecessary-parens-when-yielding-jsx-7367httpsgithubcomprettierprettierpull7367-by-cola119httpsgithubcomcola119), this works for most parsers, but ESLint throws when parsing it, [related issue](https://github.com/acornjs/acorn-jsx/issues/82). + + +```js +// Input +function* f() { + yield
generator
+} + +// Prettier 2.0 +function* f() { + yield
generator
+} + +// Prettier 2.1 +function* f() { + yield (
generator
); +} +``` + +### TypeScript + +#### Fix the `babel-ts` parser so that it emits a proper syntax error for `(a:b)` ([#8046](https://github.com/prettier/prettier/pull/8046) by [@thorn0](https://github.com/thorn0)) + +Previously, such code was parsed without errors, but an error was thrown in the printer, and this error was printed in an unfriendly way, with a stack trace. Now a proper syntax error is thrown by the parser. + + +```jsx +// Input +(a:b) + +// Prettier 2.0 +[error] test.ts: Error: unknown type: "TSTypeCastExpression" +[error] ... [a long stack trace here] ... + +// Prettier 2.1 +[error] test.ts: SyntaxError: Did not expect a type annotation here. (1:2) +[error] > 1 | (a:b) +[error] | ^ +[error] 2 | +``` + +#### Parenthesize string literals to avoid interpreting as directives ([#8422](https://github.com/prettier/prettier/pull/8422) by [@thorn0](https://github.com/thorn0)) + +Prettier wraps any string literal which is in statement position in parentheses because otherwise such strings would get interpreted as directives if they occurred at the top of a function or program, which can change the behavior of the program. It is not technically necessary to do this for strings which are not on the first line of a function or program. But doing so anyway is more consistent and can highlight bugs. See for example [this thread on twitter](https://twitter.com/dan_abramov/status/874601179334017024). + +Previously this didn't consistently work for the `typescript` parser. Only strings already wrapped in parentheses retained them. + + +```ts +// Input +f(); +'use foo'; +('use bar'); + +// Prettier 2.0 +f(); +"use foo"; +("use bar"); + +// Prettier 2.1 +f(); +("use foo"); +("use bar"); +``` + +#### Support TypeScript 3.9 breaking change for Optional Chaining and Non-Null Assertions ([#8450](https://github.com/prettier/prettier/pull/8450) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +See https://devblogs.microsoft.com/typescript/announcing-typescript-3-9/#breaking-changes + + +```ts +// Input +(a?.b)!.c; + +// Prettier 2.0 +a?.b!.c; + +// Prettier 2.1 +(a?.b)!.c; + +``` + +### Flow + +#### Fix function type param contains nullable param ([#8365](https://github.com/prettier/prettier/pull/8365) by [@fisker](https://github.com/fisker)) + + +```flow +// Input +let f: ( + ((?A) => B), +) => B; + +// Prettier 2.0 +let f: ((?A) => B) => B; + +// Prettier 2.0 (Second format) +SyntaxError: Unexpected token (1:12) +> 1 | let f: ((?A) => B) => B; + +// Prettier 2.1 +let f: (((?A) => B)) => B; +``` + +#### Fix export default of Flow Enum ([#8768](https://github.com/prettier/prettier/pull/8768) by [@gkz](https://github.com/gkz)) + +Do not add a trailing semicolon if default exporting a Flow Enum. + + +```jsx +// Input +export default enum B {} + +// Prettier 2.0 +export default enum B {}; + +// Prettier 2.1 +export default enum B {} +``` + +### CSS + +#### Do not break code with a comment at the end of an at-rule ([#7009](https://github.com/prettier/prettier/pull/7009) by [@evilebottnawi](https://github.com/evilebottnawi)) + + +```scss +/* Input */ +@at-root .foo +// .bar +{ + +} + +/* Prettier 2.0 */ +@at-root .foo +// .bar { +} + +/* Prettier 2.1 */ +@at-root .foo +// .bar +{ +} +``` + +#### Fix url() unquoted content manipulation ([#7592](https://github.com/prettier/prettier/pull/7592) by [@mattiacci](https://github.com/mattiacci)) + +Improve the handling of unquoted URL content in CSS/SCSS/Less. This doesn't +address the underlying parsing issues, but at least ensures Prettier doesn't +modify URLs. + + +```css +/* Input */ +@import url(https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap); +@import url(//fonts.googleapis.com/css?family=#{ get-font-family('Roboto') }:100,300,500,700,900&display=swap); +.validUnquotedUrls{ + background: url(data/+0ThisShouldNotBeLowerCased); + background: url(https://foo/A*3I8oSY6AKRMAAAAAAAAAAABkARQnAQ); + background: url(https://example.com/some/quite,long,url,with,commas.jpg); +} + +/* Prettier 2.0 */ +@import url( + https://fonts.googleapis.com/css?family=Roboto:100, + 300, + 400, + 500, + 700, + 900&display=swap +); +@import url( + //fonts.googleapis.com/css?family=#{get-font-family("Roboto")}:100, + 300, + 500, + 700, + 900&display=swap +); +.validUnquotedUrls { + background: url(data/+0thisshouldnotbelowercased); + background: url(https://foo/A*3i8osy6akrmaaaaaaaaaaabkarqnaq); + background: url(https://example.com/some/quite, long, url, with, commas.jpg); +} + + +/* Prettier 2.1 */ +@import url(https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&display=swap); +@import url(//fonts.googleapis.com/css?family=#{ get-font-family('Roboto') }:100,300,500,700,900&display=swap); +.validUnquotedUrls{ + background: url(data/+0ThisShouldNotBeLowerCased); + background: url(https://foo/A*3I8oSY6AKRMAAAAAAAAAAABkARQnAQ); + background: url(https://example.com/some/quite,long,url,with,commas.jpg); +} +``` + +#### Incorrect whitespace added after escaped colon in css grid line name ([#8535](https://github.com/prettier/prettier/pull/8535) by [@boyenn](https://github.com/boyenn)) + + +```css +/* Input */ +.grid { + grid-template-rows: + [row-1-00\:00] auto; +} + +/* Prettier 2.0 */ +.grid { + grid-template-rows: [row-1-00\: 00] auto; +} + +/* Prettier 2.1 */ +.grid { + grid-template-rows: [row-1-00\:00] auto; +} +``` + +#### Add support for @supports selector() ([#8545](https://github.com/prettier/prettier/pull/8545) by [@boyenn](https://github.com/boyenn)) + + +```css +/* Input */ +@supports selector(:focus-visible) { + button:focus { + outline: none; + } + + button:focus-visible { + outline: 2px solid orange; + } +} + +/* Prettier 2.0 */ +@supports selector(: focus-visible) { + button:focus { + outline: none; + } + + button:focus-visible { + outline: 2px solid orange; + } +} + +/* Prettier 2.1 */ +@supports selector(:focus-visible) { + button:focus { + outline: none; + } + + button:focus-visible { + outline: 2px solid orange; + } +} +``` + +#### Improve Prettier handling of arbitrary arguments ([#8567](https://github.com/prettier/prettier/pull/8567), [#8566](https://github.com/prettier/prettier/pull/8566) by [@boyenn](https://github.com/boyenn)) + +Prettier no longer unexpectedly add extra space after function when passing arbitrary arguments. +Prettier no longer breaks code when inline number lists are used as arbitrary arguments. + + +```css +/* Input */ +body { + test: function($list...); + foo: bar(returns-list($list)...); + background-color: rgba(50 50 50 50...); +} + +/* Prettier 2.0 */ +body { + test: function($list...); + foo: bar(returns-list($list) ...); + background-color: rgba(50 50 50 50..); +} + +/* Prettier 2.1 */ +body { + test: function($list...); + foo: bar(returns-list($list)...); + background-color: rgba(50 50 50 50...); +} +``` + +### SCSS + +#### Fix extra indentation of lines following comments in scss ([#7844](https://github.com/prettier/prettier/pull/7844) by [@boyenn](https://github.com/boyenn)) + +Previously, Prettier would place extra indentation of lines following comments within SCSS maps +Prettier now no longer places these indentations + + +```scss +/* Input */ +$my-map: ( + 'foo': 1, // Foo + 'bar': 2, // Bar +); + +/* Prettier 2.0 */ +$my-map: ( + "foo": 1, + // Foo + "bar": 2, + // Bar +); + +/* Prettier 2.1 */ +$my-map: ( + "foo": 1, + // Foo + "bar": 2, + // Bar +); +``` + +#### Fix inline comments between property and value ([#8366](https://github.com/prettier/prettier/pull/8366) by [@fisker](https://github.com/fisker)) + + +```scss +// Input +a { + color: // comment + red; +} + +// Prettier 2.0 +a { + color: // comment red; +} + +// Prettier 2.1 +a { + color: // comment + red; +} +``` + +#### Comments at the end of the file were lost if the final semicolon was omitted ([#8675](https://github.com/prettier/prettier/pull/8675) by [@fisker](https://github.com/fisker)) + + +```scss +// Input +@mixin foo() { + a { + color: #f99; + } +} + +@include foo() /* comment*/ + +// Prettier 2.0 +@mixin foo() { + a { + color: #f99; + } +} + +@include foo(); + +// Prettier 2.1 +@mixin foo() { + a { + color: #f99; + } +} + +@include foo(); /* comment*/ +``` + +### Less + +#### Fix `:extend` pseudo-class ([#8178](https://github.com/prettier/prettier/pull/8178) by [@fisker](https://github.com/fisker)) + +The selector is parsed as value before, now it's recognized as selector. + + +```less +// Input +.hello { + &:extend(.input[type="checkbox"]:checked ~ label)} + +// Prettier 2.0 +.hello { + &:extend(.input[type= "checkbox" ]: checked ~label); +} + +// Prettier 2.1 +.hello { + &:extend(.input[type="checkbox"]:checked ~ label); +} +``` + +#### Fix inline comments contains `/*` ([#8360](https://github.com/prettier/prettier/pull/8360) by [@fisker](https://github.com/fisker)) + +When inline comments contains `/*`, some other comment not correctly printed. + + +```less +// Input +@import "a"; + +// '/*' <-- this breaks formatting + +@import 'b'; +/* block */ +/*no-space block*/ + +// Prettier 2.0 +@import "a"; + +// '/*' <-- this breaks formatting + +@import "b"; + +@import 'b +@import 'b'; +/* bl + +// Prettier 2.1 +@import "a"; + +// '/*' <-- this breaks formatting + +@import "b"; +/* block */ +/*no-space block*/ +``` + +### HTML + +#### Omit trailing semicolon on single line style attributes ([#8013](https://github.com/prettier/prettier/pull/8013) by [@bschlenk](https://github.com/bschlenk)) + + +```html + +
+
+ + +
+
+ + +
+
+``` + +#### Preserve non-ASCII whitespace characters in HTML ([#8137](https://github.com/prettier/prettier/pull/8137) by [@fisker](https://github.com/fisker)) + +Non-ASCII whitespace characters like `U+00A0` `U+2005` etc. are not considered whitespace in html, they should not be removed. + +```js +// Prettier 2.0 +[...require("prettier").format(" \u2005 ", { parser: "html" })] + .slice(3, -5) + .map((c) => c.charCodeAt(0).toString(16)); + +// -> [ '20' ] +// `U+2005` is removed + +// Prettier 2.1 +[...require("prettier").format(" \u2005 ", { parser: "html" })] + .slice(3, -5) + .map((c) => c.charCodeAt(0).toString(16)); + +// -> [ '20', '2005', '20' ] +``` + +#### Support legacy HTML-like comments script blocks ([#8173](https://github.com/prettier/prettier/pull/8173) by [@fisker](https://github.com/fisker), [#8394](https://github.com/prettier/prettier/pull/8394) by [@fisker](https://github.com/fisker)) + +Previously we parse html ` + + +SyntaxError: Unexpected token (2:1) + 1 | +> 2 | + + + +``` + +#### Treat ` + + + + + + +``` + +#### Fix broken URLs with commas in srcset ([#8359](https://github.com/prettier/prettier/pull/8359) by [@fisker](https://github.com/fisker)) + + +```html + + + + + + + + +``` + +#### Support ` + + + + + + + +``` + +#### Support front matter with dynamic language ([#8381](https://github.com/prettier/prettier/pull/8381) by [@fisker](https://github.com/fisker)) + +Support [dynamic language detection](https://github.com/jonschlinkert/gray-matter#optionslanguage) in front matter, also available for `css`, `less`, `scss`, and `markdown` parser. + + +```html + +---my-awsome-language +title: Title +description: Description +--- +

+ prettier

+ + +---my-awsome-language title: Title description: Description --- + +

+ prettier +

+ + +---my-awsome-language +title: Title +description: Description +--- + +

+ prettier +

+``` + +#### Don't preserve line breaks around text-only content ([#8614](https://github.com/prettier/prettier/pull/8614) by [@fisker](https://github.com/fisker)) + +Previously, Prettier always [preserved line breaks][#5596] around inline nodes (i.e. inline elements, text, interpolations). In general, Prettier, as much as possible, tries to avoid relying on original formatting, but there are at least two cases when collapsing inline nodes into a single line is undesirable, namely list-like content and conditional constructions (e.g. `v-if`/`v-else` in Vue). A good way to detect those cases couldn't be found, so such a trade-off was made. It turned out, however, for text-only content, this relaxation of rules was unnecessary and only led to confusingly inconsistent formatting. + + +```html + +
+ Hello, world! +
+
+ Hello, {{ username }}! +
+ + +
+ Hello, world! +
+
Hello, {{ username }}!
+ + +
Hello, world!
+
Hello, {{ username }}!
+``` + +[#5596]: https://prettier.io/blog/2019/01/20/1.16.0.html#respect-surrounding-linebreaks-5596-by-ikatyang + +#### Recognize known html tags ([#8621](https://github.com/prettier/prettier/pull/8621) by [@fisker](https://github.com/fisker)) + + +```html + +
before
summary long long long long details
after
+
beforedialog long long long long long long long long after
+
beforeafter
+ + +
+ before
summary long long long long details
after +
+
+ beforedialog long long long long long long long long after +
+
+ beforeafter +
+ + +
+ before +
+ summary long long long long + details +
+ after +
+
+ before + dialog long long long long long long long long + after +
+
+ before + + after +
+``` + +#### Fix formatting element with void element as its last child ([#8643](https://github.com/prettier/prettier/pull/8643) by [@ikatyang](https://github.com/ikatyang)) + + +```html + +text after + + +text after + + +text after +``` + +### Vue + +#### Improve formatting Vue SFC root blocks ([#8023](https://github.com/prettier/prettier/pull/8023) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#8465](https://github.com/prettier/prettier/pull/8465) by [@fisker](https://github.com/fisker)) + +Support formatting all [language blocks](https://vue-loader.vuejs.org/spec.html#language-blocks)(including [custom blocks](https://vue-loader.vuejs.org/spec.html#custom-blocks) with `lang` attribute) with [builtin parsers](https://prettier.io/docs/en/options.html#parser) and [plugins](https://prettier.io/docs/en/plugins.html). + + +```html + + + +{ +"hello": 'prettier',} + + + + + +{ +"hello": 'prettier',} + + + + + +{ + "hello": "prettier" +} + +``` + +**[@prettier/plugin-pug](https://github.com/prettier/plugin-pug) is required for this example.** + +#### Improve parsing for custom blocks ([#8153](https://github.com/prettier/prettier/pull/8153) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```html + + +const foo = " + + +SyntaxError: Unexpected character """ (2:19) +[error] 1 | +[error] > 2 | const foo = " + + + +const foo = " +``` + +#### Fix broken format with upper case HTML tag ([#8280](https://github.com/prettier/prettier/pull/8280) by [@fisker](https://github.com/fisker)) + + +```html + + + + +> + + + +``` + +#### Fix ugly formatting for one line `template` in Vue SFC ([#8325](https://github.com/prettier/prettier/pull/8325) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```html + + + + + + + + +``` + +#### Support Vue DOM Template ([#8326](https://github.com/prettier/prettier/pull/8326) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + +When use vue parse for HTML, parse template as HTML. + + +```html + + + + +
+
First Line
Second Line
+
+ + + + + + + + + +
First Line
Second Line
+ + + + + + + + + +
+
First Line
+
Second Line
+
+ + + + +``` + +#### Improve upper case HTML tag formatting in DOM template ([#8337](https://github.com/prettier/prettier/pull/8337) by [@sosukesuzuki](https://github.com/sosukesuzuki)) + + +```html + + + +
+ +
+ + + + + + + + +
+ +
+ + + + + + + + +
+ + + +``` + +#### Fix parenthesized interpolation format ([#8747](https://github.com/prettier/prettier/pull/8747) by [@fisker](https://github.com/fisker)) + + +```vue + + + + + + + + +``` + +#### Fix named slots shorthand value is not formatted ([#8839](https://github.com/prettier/prettier/pull/8839) by [@wenfangdu](https://github.com/wenfangdu)) + + +```vue + + + + + + + + +``` + +### Angular + +#### Fix optional chaining with computed properties and handling of `this` ([#8253](https://github.com/prettier/prettier/pull/8253) by [@thorn0](https://github.com/thorn0), [#7942](https://github.com/prettier/prettier/pull/8253) by [@fisker](https://github.com/fisker), fixes in [`angular-estree-parser`](https://github.com/ikatyang/angular-estree-parser) by [@ikatyang](https://github.com/ikatyang)) + + +```html + +{{ a?.b[c] }} +{{ a ( this )}} + + +{{ (a?.b)[c] }} +{{ a ( this )}} + + +{{ a?.b[c] }} +{{ a(this) }} +``` + +#### Preserve parentheses around pipes in objects literals for compatibility with AngularJS 1.x ([#8254](https://github.com/prettier/prettier/pull/8254) by [@thorn0](https://github.com/thorn0)) + + +```html + +
+ + +
+ + +
+``` + +### Handlebars (alpha) + +#### Respect singleQuote option around attribute value more complex than a bare text ([#8375](https://github.com/prettier/prettier/pull/8375) by [@dcyriller](https://github.com/dcyriller) + + +```hbs +{{!-- Input --}} +
+ + + + + +{{!-- Prettier 2.0 --}} + + + + + + +{{!-- Prettier 2.1 --}} + + + + + +``` + +#### Fix formatting of classic components inside element ([#8593](https://github.com/prettier/prettier/pull/8593) by [@mikoscz](https://github.com/mikoscz) + + +```hbs +{{!-- Input --}} +
+ {{classic-component-with-many-properties + class="hello" + param=this.someValue + secondParam=this.someValue + thirdParam=this.someValue + }} +
+ +{{!-- Prettier 2.0 --}} +
+ {{ + classic-component-with-many-properties + class="hello" + param=this.someValue + secondParam=this.someValue + thirdParam=this.someValue + }} +
+ +{{!-- Prettier 2.1 --}} +
+ {{classic-component-with-many-properties + class="hello" + param=this.someValue + secondParam=this.someValue + thirdParam=this.someValue + }} +
+``` + +#### Support escaping a mustache with a backslash ([#8634](https://github.com/prettier/prettier/pull/8634) by [@dcyriller](https://github.com/dcyriller) + + +```hbs +{{!-- Input --}} +\{{mustache}} +\\{{mustache}} +\\\{{mustache}} + +{{!-- Prettier 2.0 --}} +{{mustache}} +\{{mustache}} +\\{{mustache}} + +{{!-- Prettier 2.1 --}} +\{{mustache}} +\\{{mustache}} +\\\{{mustache}} +``` + +#### Format only class names in attributes ([#8677](https://github.com/prettier/prettier/pull/8677) by [@dcyriller](https://github.com/dcyriller) + + +```hbs +{{!-- Input --}} +
+
+ +{{!-- Prettier 2.0 --}} +
+
+ +{{!-- Prettier 2.1 --}} +
+
+``` + +### GraphQL + +#### Improve wrapping of GraphQL fragment directives ([#7721](https://github.com/prettier/prettier/pull/7721) by [@sasurau4](https://github.com/sasurau4)) + + +```graphql +# Input +fragment TodoList_list on TodoList @argumentDefinitions( + count: {type: "Int", defaultValue: 10}, +) { + title +} + +# Prettier 2.0 +fragment TodoList_list on TodoList + @argumentDefinitions(count: { type: "Int", defaultValue: 10 }) { + title +} + +# Prettier 2.1 +fragment TodoList_list on TodoList +@argumentDefinitions(count: { type: "Int", defaultValue: 10 }) { + title +} +``` + +#### Fix comments between interfaces ([#8006](https://github.com/prettier/prettier/pull/8006) by [@fisker](https://github.com/fisker)) + + +```graphql +# Input +type Type1 implements + A & +# comment 1 + B +# comment 2 + & C {a: a} + +# Prettier 2.0 +type Type1 implements A & # comment 1 +B & # comment 2 +C { + a: a +} + +# Prettier 2.0 (Second format) +type Type1 implements A & B & C { # comment 1 # comment 2 + a: a +} + +# Prettier 2.1 +type Type1 implements A & +# comment 1 +B & +# comment 2 +C { + a: a +} +``` + +#### Allow interfaces to implement other interfaces ([#8007](https://github.com/prettier/prettier/pull/8007) by [@fisker](https://github.com/fisker)) + +See ["RFC: Allow interfaces to implement other interfaces"](https://github.com/graphql/graphql-spec/pull/373) + + +```graphql +# Input +interface Resource implements Node { + id: ID! + url: String +} + +# Prettier 2.0 +interface Resource { + id: ID! + url: String +} + +# Prettier 2.1 +interface Resource implements Node { + id: ID! + url: String +} +``` + +### Markdown + +#### Update `remark-parse` to v8 ([#8140](https://github.com/prettier/prettier/pull/8140) by [@saramarcondes](https://github.com/saramarcondes), [@fisker](https://github.com/fisker), [@thorn0](https://github.com/thorn0)) + +[remark](https://remark.js.org/), the Markdown parser that Prettier uses, got a long-overdue update (5.0.0 → 8.0.2, see [remark's changelog](https://github.com/remarkjs/remark/releases)). This fixed tons of old bugs, in particular related to parsing list items indented with tabs. + +Please note that the new version is stricter in parsing footnotes, a syntax extension not defined in any specification. Previously, Prettier would parse (and output, depending on the `--tab-width` option) multiline footnotes indented with any number of spaces. The new version recognizes only multiline footnotes indented with 4 spaces. This change isn't considered breaking as the syntax is non-standard, but if you happen to use it, before updating Prettier, you might want to use its older version with `--tab-width=4` to make footnotes in your files compatible with the new version. + +#### Correctly format CJK sentences with Variation Selector ([#8511](https://github.com/prettier/prettier/pull/8511) by [@ne-sachirou](https://github.com/ne-sachirou)) + + +```markdown + +麻󠄁羽󠄀‼️ + + +麻 󠄁 羽 󠄀 ‼️ + + +麻󠄁羽󠄀‼️ +``` + +### YAML + +#### Fix unstable format with `prettier-ignore` ([#8355](https://github.com/prettier/prettier/pull/8355) by [@fisker](https://github.com/fisker)) + + +```yaml +# Input +# prettier-ignore +--- +prettier: true +... +hello: world + +# Prettier 2.0 +# prettier-ignore +--- +prettier: true +--- +hello: world + +# Prettier 2.0 (Second format) +# prettier-ignore +--- +prettier: true + +--- +hello: world + +# Prettier 2.1 +# prettier-ignore +--- +prettier: true +--- +hello: world + +``` + +#### Preserve blank lines in comments ([#8356](https://github.com/prettier/prettier/pull/8356) by [@fisker](https://github.com/fisker)) + + +```yaml +# Input +a: + - a: a + + # - b: b + + # - c: c + + - d: d + + +b: + - a: a + + # - b: b + + # - c: c + +# Prettier 2.0 +a: + - a: a + + # - b: b + + # - c: c + + - d: d + +b: + - a: a + # - b: b + # - c: c + +# Prettier 2.1 +a: + - a: a + + # - b: b + + # - c: c + + - d: d + +b: + - a: a + + # - b: b + + # - c: c +``` + +#### Update `yaml` and `yaml-unist-parser` ([#8386](https://github.com/prettier/prettier/pull/8386) by [@fisker](https://github.com/fisker), fixes in [`yaml-unist-parser`](https://github.com/ikatyang/yaml-unist-parser) by [@ikatyang](https://github.com/ikatyang)) + +- `yaml`: [Add explicit error for block scalars with more-indented leading empty lines](https://github.com/eemeli/yaml/commit/7eafeb821d4a89d4de26f5b3798ee6e009e99b12) +- `yaml-unist-parser`: [fix: no false positive for document head end marker position](https://github.com/ikatyang/yaml-unist-parser/pull/272) + + +```yaml +# Input +# --- comments --- + +# Prettier 2.0 +--- # --- comments --- + +# Prettier 2.1 +# --- comments --- + +# Input +empty block scalar: > + + # comment + +# Prettier 2.0 +empty block scalar: > + +# comment + +# Prettier 2.1 +SyntaxError: Block scalars with more-indented leading empty lines must use an explicit indentation indicator (1:21) +> 1 | empty block scalar: > + | ^ +> 2 | + | ^^ +> 3 | # comment + | ^^^^^^^^^^^ +``` + +#### Fix error on YAML Inline Extend syntax ([#8888](https://github.com/prettier/prettier/pull/8888) by [@fisker](https://github.com/fisker), [@evilebottnawi](https://github.com/evilebottnawi), fixes in [`yaml-unist-parser`](https://github.com/ikatyang/yaml-unist-parser) by [@ikatyang](https://github.com/ikatyang)) + + +```yaml +# Input +foo: + <<: &anchor + K1: "One" + K2: "Two" + +bar: + <<: *anchor + K3: "Three" + +# Prettier 2.0 +SyntaxError: Merge nodes can only have Alias nodes as values (2:2) + 1 | foo: +> 2 | <<: &anchor + | ^^^^^^^^^^^ +> 3 | K1: "One" + | ^^^^^^^^^^^^ +> 4 | K2: "Two" + | ^^^^^^^^^^^^ +> 5 | + | ^ + 6 | bar: + 7 | <<: *anchor + 8 | K3: "Three" + +# Prettier 2.1 +foo: + <<: &anchor + K1: "One" + K2: "Two" + +bar: + <<: *anchor + K3: "Three" +``` + +### API + +#### Add plugins' parsers to the `parser` option ([#8390](https://github.com/prettier/prettier/pull/8390) by [@thorn0](https://github.com/thorn0)) + +When a plugin defines a language, the parsers specified for this language are now automatically added to the list of valid values of the `parser` option. +This might be useful for editor integrations or other applications that need a list of available parsers. + +```bash +npm install --save-dev --save-exact prettier @prettier/plugin-php +``` + +```js +const hasPhpParser = prettier + .getSupportInfo() + .options.find((option) => option.name === "parser") + .choices.map((choice) => choice.value) + .includes("php"); // false in Prettier 2.0, true in Prettier 2.1 +``` + +#### Fix `prettier.getFileInfo()` ([#8548](https://github.com/prettier/prettier/pull/8548), [#8551](https://github.com/prettier/prettier/pull/8551), [#8585](https://github.com/prettier/prettier/pull/8585) by [@fisker](https://github.com/fisker)) + +- When passing `{resolveConfig: true}`, the `inferredParser` should be the parser resolved from config file, previous version might returns wrong result for files supported by builtin parsers. +- When passing `{resolveConfig: true}` and `{ignorePath: "a/file/in/different/dir"}`, the `inferredParser` result might incorrect. +- If given `filePath` is ignored, the `inferredParser` is always `null` now. + + +```console +$ echo {"parser":"flow"}>.prettierrc +$ node -p "require('prettier').getFileInfo.sync('./foo.js', {resolveConfig: true})" + +# Prettier 2.0 +# { ignored: false, inferredParser: 'babel' } + +# Prettier 2.1 +# { ignored: false, inferredParser: 'flow' } +``` + + +```console +$ echo ignored.js>>.prettierignore +$ node -p "require('prettier').getFileInfo.sync('./ignored.js')" + +# Prettier 2.0 +# { ignored: true, inferredParser: 'babel' } + +# Prettier 2.1 +# { ignored: true, inferredParser: null } +``` + +#### Fix resolve editorConfig for files in deep directory ([#8591](https://github.com/prettier/prettier/pull/8591) by [@fisker](https://github.com/fisker)) + +Previous version can't find `.editorconfig` for files in deep directory (depth great than 9 to project root, see #5705). + +#### Support `.cjs` and `.json5` configuration files ([#8890](https://github.com/prettier/prettier/pull/8890), [#8957](https://github.com/prettier/prettier/pull/8957) by [@fisker](https://github.com/fisker)) + +Added new format of configuration files: + +- `.prettierrc.json5` +- `.prettierrc.cjs` +- `prettier.config.cjs` + +#### Fix wrong range format on files with BOM ([#8936](https://github.com/prettier/prettier/pull/8936) by [@fisker](https://github.com/fisker)) + +When files have BOM, in previous version, the real range is wrongly calculated. + + +```js +const text = "\uFEFF" + "foo = 1.0000;bar = 1.0000;"; +// ^^^^^^^^^^^^^ Range +const result = require("prettier") + .format(text, { + parser: "babel", + rangeStart: 1, + rangeEnd: 13, + }) + // Visualize BOM + .replace("\uFEFF", "<>") + // Visualize EOL + .replace("\n", "<>"); + +console.log(result); + +// Prettier 2.0 +// -> <>foo = 1.0;<>bar = 1.0; +// ^^^^^^^^^ This part should not be formatted + +// Prettier 2.1 +// -> <>foo = 1.0;bar = 1.0000; +``` + +### CLI + +#### Fix filenames contains CJK or emoji not correctly ignored ([#8098](https://github.com/prettier/prettier/pull/8098) by [@fisker](https://github.com/fisker)) + +```console +// Prettier 2.0 +$ echo "dir" > .prettierignore +$ prettier **/*.js -l +dir/😁.js +dir/中文.js +not-ignored.js + +// Prettier 2.1 +$ echo "dir" > .prettierignore +$ prettier **/*.js -l +not-ignored.js +``` + +#### `--file-info` respect the `.prettierrc` and `--no-config` ([#8586](https://github.com/prettier/prettier/pull/8586), [#8830](https://github.com/prettier/prettier/pull/8830) by [@fisker](https://github.com/fisker)) + +```console +$ echo {"parser":"ninja"}>.prettierrc + +# Prettier 2.0 +$ prettier --file-info file.js +# { "ignored": false, "inferredParser": "babel" } +$ prettier --file-info file.js --no-config +# { "ignored": false, "inferredParser": "babel" } + +# Prettier 2.1 +$ prettier --file-info file.js +# { "ignored": false, "inferredParser": "ninja" } +$ prettier --file-info file.js --no-config +# { "ignored": false, "inferredParser": "babel" } +``` + +#### Added `--ignore-unknown`(alias `-u`) flag ([#8829](https://github.com/prettier/prettier/pull/8829) by [@fisker](https://github.com/fisker)) + +```console +# Prettier 2.0 +npx prettier * --check +Checking formatting... +foo.unknown[error] No parser could be inferred for file: foo.unknown +All matched files use Prettier code style! + +# Prettier 2.1 +npx prettier * --check --ignore-unknown +Checking formatting... +All matched files use Prettier code style! +``` + +#### Add `-w` alias for `--write` option ([#8833](https://github.com/prettier/prettier/pull/8833) by [@fisker](https://github.com/fisker)) + +```console +# Prettier 2.0 +$ prettier index.js -w +[warn] Ignored unknown option -w. Did you mean -_? +"use strict"; + +module.exports = require("./src/index"); + +# Prettier 2.1 +$ prettier index.js -w +index.js 30ms +``` + +#### Stop suggesting `-_` for unknown options ([#8934](https://github.com/prettier/prettier/pull/8934) by [@fisker](https://github.com/fisker)) + +```console +# Prettier 2.0 +$ prettier foo.js -a +[warn] Ignored unknown option -a. Did you mean -_? + +# Prettier 2.1 +$ prettier foo.js -a +[warn] Ignored unknown option -a. Did you mean -c? +``` diff --git a/website/siteConfig.js b/website/siteConfig.js index 10e73992a..85f1d82d8 100644 --- a/website/siteConfig.js +++ b/website/siteConfig.js @@ -54,7 +54,7 @@ const siteConfig = { theme: "default", version: require("highlight.js/package.json").version, }, - usePrism: ["javascript", "jsx", "typescript", "ts", "js", "html"], + usePrism: ["javascript", "jsx", "typescript", "ts", "js", "html", "css"], useEnglishUrl: true, scripts: ["https://buttons.github.io/buttons.js"], stylesheets: [