Release 2.8.4
This commit is contained in:
1 parent
6bb24b2c5a
commit
e681edb67c
6 files changed
+156
-33
No files matched your search
@@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you:
|
||||
|
||||
-->
|
||||
|
||||
**Prettier 2.8.3**
|
||||
**Prettier 2.8.4**
|
||||
[Playground link](https://prettier.io/playground/#.....)
|
||||
|
||||
```sh
|
||||
|
||||
@@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:
|
||||
|
||||
**Environments:**
|
||||
|
||||
- Prettier Version: 2.8.3
|
||||
- Prettier Version: 2.8.4
|
||||
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
|
||||
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
|
||||
- Operating System: <!-- Windows, Linux, macOS, etc. -->
|
||||
|
||||
+123
@@ -1,3 +1,126 @@
|
||||
# 2.8.4
|
||||
|
||||
[diff](https://github.com/prettier/prettier/compare/2.8.3...2.8.4)
|
||||
|
||||
#### Fix leading comments in mapped types with `readonly` ([#13427](https://github.com/prettier/prettier/pull/13427) by [@thorn0](https://github.com/thorn0), [@sosukesuzuki](https://github.com/sosukesuzuki))
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```tsx
|
||||
// Input
|
||||
type Type = {
|
||||
// comment
|
||||
readonly [key in Foo];
|
||||
};
|
||||
|
||||
// Prettier 2.8.3
|
||||
type Type = {
|
||||
readonly // comment
|
||||
[key in Foo];
|
||||
};
|
||||
|
||||
// Prettier 2.8.4
|
||||
type Type = {
|
||||
// comment
|
||||
readonly [key in Foo];
|
||||
};
|
||||
```
|
||||
|
||||
#### Group params in opening block statements ([#14067](https://github.com/prettier/prettier/pull/14067) by [@jamescdavis](https://github.com/jamescdavis))
|
||||
|
||||
This is a follow-up to #13930 to establish wrapping consistency between opening block statements and else blocks by
|
||||
grouping params in opening blocks. This causes params to break to a new line together and not be split across lines
|
||||
unless the length of params exceeds the print width. This also updates the else block wrapping to behave exactly the
|
||||
same as opening blocks.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```hbs
|
||||
{{! Input }}
|
||||
{{#block param param param param param param param param param param as |blockParam|}}
|
||||
Hello
|
||||
{{else block param param param param param param param param param param as |blockParam|}}
|
||||
There
|
||||
{{/block}}
|
||||
|
||||
{{! Prettier 2.8.3 }}
|
||||
{{#block
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
as |blockParam|
|
||||
}}
|
||||
Hello
|
||||
{{else block param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param
|
||||
param}}
|
||||
There
|
||||
{{/block}}
|
||||
|
||||
{{! Prettier 2.8.4 }}
|
||||
{{#block
|
||||
param param param param param param param param param param
|
||||
as |blockParam|
|
||||
}}
|
||||
Hello
|
||||
{{else block
|
||||
param param param param param param param param param param
|
||||
as |blockParam|
|
||||
}}
|
||||
There
|
||||
{{/block}}
|
||||
```
|
||||
|
||||
#### Ignore files in `.sl/` ([#14206](https://github.com/prettier/prettier/pull/14206) by [@bolinfest](https://github.com/bolinfest))
|
||||
|
||||
In [Sapling SCM](https://sapling-scm.com/), `.sl/` is the folder where it stores its state, analogous to `.git/` in Git. It should be ignored in Prettier like the other SCM folders.
|
||||
|
||||
#### Recognize `@satisfies` in Closure-style type casts ([#14262](https://github.com/prettier/prettier/pull/14262) by [@fisker](https://github.com/fisker))
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
const a = /** @satisfies {Record<string, string>} */ ({hello: 1337});
|
||||
const b = /** @type {Record<string, string>} */ ({hello: 1337});
|
||||
|
||||
// Prettier 2.8.3
|
||||
const a = /** @satisfies {Record<string, string>} */ { hello: 1337 };
|
||||
const b = /** @type {Record<string, string>} */ ({ hello: 1337 });
|
||||
|
||||
// Prettier 2.8.4
|
||||
const a = /** @satisfies {Record<string, string>} */ ({hello: 1337});
|
||||
const b = /** @type {Record<string, string>} */ ({hello: 1337});
|
||||
```
|
||||
|
||||
#### Fix parens in inferred function return types with `extends` ([#14279](https://github.com/prettier/prettier/pull/14279) by [@fisker](https://github.com/fisker))
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```ts
|
||||
// Input
|
||||
type Foo<T> = T extends ((a) => a is infer R extends string) ? R : never;
|
||||
|
||||
// Prettier 2.8.3 (First format)
|
||||
type Foo<T> = T extends (a) => a is infer R extends string ? R : never;
|
||||
|
||||
// Prettier 2.8.3 (Second format)
|
||||
SyntaxError: '?' expected.
|
||||
|
||||
// Prettier 2.8.4
|
||||
type Foo<T> = T extends ((a) => a is infer R extends string) ? R : never;
|
||||
```
|
||||
|
||||
# 2.8.3
|
||||
|
||||
[diff](https://github.com/prettier/prettier/compare/2.8.2...2.8.3)
|
||||
|
||||
+15
-15
@@ -20,8 +20,8 @@ Required options:
|
||||
|
||||
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files named
|
||||
|
||||
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.3/> and
|
||||
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.3/esm/>
|
||||
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.4/> and
|
||||
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.4/esm/>
|
||||
|
||||
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
|
||||
|
||||
@@ -32,8 +32,8 @@ See below for examples.
|
||||
### Global
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/prettier@2.8.3/standalone.js"></script>
|
||||
<script src="https://unpkg.com/prettier@2.8.3/parser-graphql.js"></script>
|
||||
<script src="https://unpkg.com/prettier@2.8.4/standalone.js"></script>
|
||||
<script src="https://unpkg.com/prettier@2.8.4/parser-graphql.js"></script>
|
||||
<script>
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
@@ -48,8 +48,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import prettier from "https://unpkg.com/prettier@2.8.3/esm/standalone.mjs";
|
||||
import parserGraphql from "https://unpkg.com/prettier@2.8.3/esm/parser-graphql.mjs";
|
||||
import prettier from "https://unpkg.com/prettier@2.8.4/esm/standalone.mjs";
|
||||
import parserGraphql from "https://unpkg.com/prettier@2.8.4/esm/parser-graphql.mjs";
|
||||
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
@@ -62,8 +62,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
|
||||
|
||||
```js
|
||||
define([
|
||||
"https://unpkg.com/prettier@2.8.3/standalone.js",
|
||||
"https://unpkg.com/prettier@2.8.3/parser-graphql.js",
|
||||
"https://unpkg.com/prettier@2.8.4/standalone.js",
|
||||
"https://unpkg.com/prettier@2.8.4/parser-graphql.js",
|
||||
], (prettier, ...plugins) => {
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
@@ -88,8 +88,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
|
||||
### Worker
|
||||
|
||||
```js
|
||||
importScripts("https://unpkg.com/prettier@2.8.3/standalone.js");
|
||||
importScripts("https://unpkg.com/prettier@2.8.3/parser-graphql.js");
|
||||
importScripts("https://unpkg.com/prettier@2.8.4/standalone.js");
|
||||
importScripts("https://unpkg.com/prettier@2.8.4/parser-graphql.js");
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
plugins: prettierPlugins,
|
||||
@@ -102,8 +102,8 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import prettier from "https://unpkg.com/prettier@2.8.3/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.3/esm/parser-babel.mjs";
|
||||
import prettier from "https://unpkg.com/prettier@2.8.4/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.4/esm/parser-babel.mjs";
|
||||
|
||||
console.log(
|
||||
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
|
||||
@@ -119,9 +119,9 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import prettier from "https://unpkg.com/prettier@2.8.3/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.3/esm/parser-babel.mjs";
|
||||
import parserHtml from "https://unpkg.com/prettier@2.8.3/esm/parser-html.mjs";
|
||||
import prettier from "https://unpkg.com/prettier@2.8.4/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.4/esm/parser-babel.mjs";
|
||||
import parserHtml from "https://unpkg.com/prettier@2.8.4/esm/parser-html.mjs";
|
||||
|
||||
console.log(
|
||||
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "prettier",
|
||||
"version": "2.9.0-dev",
|
||||
"version": "2.8.4",
|
||||
"description": "Prettier is an opinionated code formatter",
|
||||
"bin": "./bin/prettier.js",
|
||||
"repository": "prettier/prettier",
|
||||
|
||||
@@ -21,8 +21,8 @@ Required options:
|
||||
|
||||
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files named
|
||||
|
||||
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.3/> and
|
||||
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.3/esm/>
|
||||
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.4/> and
|
||||
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.4/esm/>
|
||||
|
||||
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
|
||||
|
||||
@@ -33,8 +33,8 @@ See below for examples.
|
||||
### Global
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/prettier@2.8.3/standalone.js"></script>
|
||||
<script src="https://unpkg.com/prettier@2.8.3/parser-graphql.js"></script>
|
||||
<script src="https://unpkg.com/prettier@2.8.4/standalone.js"></script>
|
||||
<script src="https://unpkg.com/prettier@2.8.4/parser-graphql.js"></script>
|
||||
<script>
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
@@ -49,8 +49,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import prettier from "https://unpkg.com/prettier@2.8.3/esm/standalone.mjs";
|
||||
import parserGraphql from "https://unpkg.com/prettier@2.8.3/esm/parser-graphql.mjs";
|
||||
import prettier from "https://unpkg.com/prettier@2.8.4/esm/standalone.mjs";
|
||||
import parserGraphql from "https://unpkg.com/prettier@2.8.4/esm/parser-graphql.mjs";
|
||||
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
@@ -63,8 +63,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
|
||||
|
||||
```js
|
||||
define([
|
||||
"https://unpkg.com/prettier@2.8.3/standalone.js",
|
||||
"https://unpkg.com/prettier@2.8.3/parser-graphql.js",
|
||||
"https://unpkg.com/prettier@2.8.4/standalone.js",
|
||||
"https://unpkg.com/prettier@2.8.4/parser-graphql.js",
|
||||
], (prettier, ...plugins) => {
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
@@ -89,8 +89,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
|
||||
### Worker
|
||||
|
||||
```js
|
||||
importScripts("https://unpkg.com/prettier@2.8.3/standalone.js");
|
||||
importScripts("https://unpkg.com/prettier@2.8.3/parser-graphql.js");
|
||||
importScripts("https://unpkg.com/prettier@2.8.4/standalone.js");
|
||||
importScripts("https://unpkg.com/prettier@2.8.4/parser-graphql.js");
|
||||
prettier.format("type Query { hello: String }", {
|
||||
parser: "graphql",
|
||||
plugins: prettierPlugins,
|
||||
@@ -103,8 +103,8 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import prettier from "https://unpkg.com/prettier@2.8.3/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.3/esm/parser-babel.mjs";
|
||||
import prettier from "https://unpkg.com/prettier@2.8.4/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.4/esm/parser-babel.mjs";
|
||||
|
||||
console.log(
|
||||
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
|
||||
@@ -120,9 +120,9 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import prettier from "https://unpkg.com/prettier@2.8.3/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.3/esm/parser-babel.mjs";
|
||||
import parserHtml from "https://unpkg.com/prettier@2.8.3/esm/parser-html.mjs";
|
||||
import prettier from "https://unpkg.com/prettier@2.8.4/esm/standalone.mjs";
|
||||
import parserBabel from "https://unpkg.com/prettier@2.8.4/esm/parser-babel.mjs";
|
||||
import parserHtml from "https://unpkg.com/prettier@2.8.4/esm/parser-html.mjs";
|
||||
|
||||
console.log(
|
||||
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
|
||||
|
||||
Reference in new issue
Block a user