Merge remote-tracking branch 'remotes/upstream/main' into next

# Conflicts:
#	docs/browser.md
#	package.json
#	scripts/release/release.js
#	src/language-js/parse/postprocess/index.js
#	src/language-js/parse/postprocess/typescript.js
#	src/language-js/parse/typescript.js
#	src/language-js/print/type-parameters.js
#	tests/format/js/export-star/__snapshots__/jsfmt.spec.js.snap
#	tests/format/js/export-star/jsfmt.spec.js
#	tests/format/js/export/__snapshots__/jsfmt.spec.js.snap
#	tests/format/js/export/jsfmt.spec.js
#	tests/format/misc/typescript-only/__snapshots__/jsfmt.spec.js.snap
#	tests/format/typescript/decorators/jsfmt.spec.js
#	tests/format/typescript/export/jsfmt.spec.js
#	yarn.lock
This commit is contained in:
fisker committed 2023-03-20 14:21:15 +08:00
commit aaffacce2c
12 files changed
+110 -94

No files matched your search

+2
View File
@@ -5,6 +5,8 @@
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
# Prettier bump after release
# 2.8.5
c1808e86a3c7c2c8f43093f99e78fce3b6d0a97d
# 2.8.4
f3b23ab63c9387329dc1993e1d0aa71583d67a0b
# 2.8.3
+1 -1
View File
@@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you:
-->
**Prettier 2.8.4**
**Prettier 2.8.5**
[Playground link](https://prettier.io/playground/#.....)
```sh
+1 -1
View File
@@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:
**Environments:**
- Prettier Version: 2.8.4
- Prettier Version: 2.8.5
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
+70
View File
@@ -1,3 +1,73 @@
# 2.8.5
[diff](https://github.com/prettier/prettier/compare/2.8.4...2.8.5)
#### Support TypeScript 5.0 ([#14391](https://github.com/prettier/prettier/pull/14391) by [@fisker](https://github.com/fisker), [#13819](https://github.com/prettier/prettier/pull/13819) by [@fisker](https://github.com/fisker), [@sosukesuzuki](https://github.com/sosukesuzuki))
TypeScript 5.0 introduces two new syntactic features:
- `const` modifiers for type parameters
- `export type *` declarations
#### Add missing parentheses for decorator ([#14393](https://github.com/prettier/prettier/pull/14393) by [@fisker](https://github.com/fisker))
<!-- prettier-ignore -->
```jsx
// Input
class Person {
@(myDecoratorArray[0])
greet() {}
}
// Prettier 2.8.4
class Person {
@myDecoratorArray[0]
greet() {}
}
// Prettier 2.8.5
class Person {
@(myDecoratorArray[0])
greet() {}
}
```
#### Add parentheses for `TypeofTypeAnnotation` to improve readability ([#14458](https://github.com/prettier/prettier/pull/14458) by [@fisker](https://github.com/fisker))
<!-- prettier-ignore -->
```tsx
// Input
type A = (typeof node.children)[];
// Prettier 2.8.4
type A = typeof node.children[];
// Prettier 2.8.5
type A = (typeof node.children)[];
```
#### Support `max_line_length=off` when parsing `.editorconfig` ([#14516](https://github.com/prettier/prettier/pull/14516) by [@josephfrazier](https://github.com/josephfrazier))
If an .editorconfig file is in your project and it sets `max_line_length=off` for the file you're formatting,
it will be interpreted as a `printWidth` of `Infinity` rather than being ignored
(which previously resulted in the default `printWidth` of 80 being applied, if not overridden by Prettier-specific configuration).
<!-- prettier-ignore -->
```html
<!-- Input -->
<div className='HelloWorld' title={`You are visitor number ${ num }`} onMouseOver={onMouseOver}/>
<!-- Prettier 2.8.4 -->
<div
className="HelloWorld"
title={`You are visitor number ${num}`}
onMouseOver={onMouseOver}
/>;
<!-- Prettier 2.8.5 -->
<div className="HelloWorld" title={`You are visitor number ${num}`} onMouseOver={onMouseOver} />;
```
# 2.8.4
[diff](https://github.com/prettier/prettier/compare/2.8.3...2.8.4)
-13
View File
@@ -1,13 +0,0 @@
#### Add parentheses for `TypeofTypeAnnotation` to improve readability (#14458 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
type A = (typeof node.children)[];
// Prettier stable
type A = typeof node.children[];
// Prettier main
type A = (typeof node.children)[];
```
-22
View File
@@ -1,22 +0,0 @@
#### Add missing parentheses for decorator (#14393 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
class Person {
@(myDecoratorArray[0])
greet() {}
}
// Prettier stable
class Person {
@myDecoratorArray[0]
greet() {}
}
// Prettier main
class Person {
@(myDecoratorArray[0])
greet() {}
}
```
-21
View File
@@ -1,21 +0,0 @@
#### Support `max_line_length=off` when parsing `.editorconfig` (#14516 by @josephfrazier)
If an .editorconfig file is in your project and it sets `max_line_length=off` for the file you're formatting,
it will be interpreted as a `printWidth` of `Infinity` rather than being ignored
(which previously resulted in the default `printWidth` of 80 being applied, if not overridden by Prettier-specific configuration).
<!-- prettier-ignore -->
```html
<!-- Input -->
<div className='HelloWorld' title={`You are visitor number ${ num }`} onMouseOver={onMouseOver}/>
<!-- Prettier stable -->
<div
className="HelloWorld"
title={`You are visitor number ${num}`}
onMouseOver={onMouseOver}
/>;
<!-- Prettier main -->
<div className="HelloWorld" title={`You are visitor number ${num}`} onMouseOver={onMouseOver} />;
```
+14 -14
View File
@@ -18,7 +18,7 @@ Required options:
- **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use.
- **`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 in <https://unpkg.com/browse/prettier@2.8.4/plugins/>
- **`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 in <https://unpkg.com/browse/prettier@2.8.5/plugins/>
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
@@ -29,8 +29,8 @@ See below for examples.
### Global
```html
<script src="https://unpkg.com/prettier@2.8.4/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.4/plugins/graphql.js"></script>
<script src="https://unpkg.com/prettier@2.8.5/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.5/plugins/graphql.js"></script>
<script>
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
@@ -47,8 +47,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@2.8.4/standalone.mjs";
import pluginGraphql from "https://unpkg.com/prettier@2.8.4/plugins/graphql.mjs";
import * as prettier from "https://unpkg.com/prettier@2.8.5/standalone.mjs";
import pluginGraphql from "https://unpkg.com/prettier@2.8.5/plugins/graphql.mjs";
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -61,8 +61,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
```js
define([
"https://unpkg.com/prettier@2.8.4/standalone.js",
"https://unpkg.com/prettier@2.8.4/plugins/graphql.js",
"https://unpkg.com/prettier@2.8.5/standalone.js",
"https://unpkg.com/prettier@2.8.5/plugins/graphql.js",
], async (prettier, ...plugins) => {
const formatted = await 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.4/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.4/plugins/graphql.js");
importScripts("https://unpkg.com/prettier@2.8.5/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.5/plugins/graphql.js");
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -105,8 +105,8 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@2.8.4/standalone.mjs";
import pluginBabel from "https://unpkg.com/prettier@2.8.4/plugins/babel.mjs";
import * as prettier from "https://unpkg.com/prettier@2.8.5/standalone.mjs";
import pluginBabel from "https://unpkg.com/prettier@2.8.5/plugins/babel.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -122,9 +122,9 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@2.8.4/standalone.mjs";
import pluginBabel from "https://unpkg.com/prettier@2.8.4/plugins/babel.mjs";
import pluginHtml from "https://unpkg.com/prettier@2.8.4/plugins/html.mjs";
import * as prettier from "https://unpkg.com/prettier@2.8.5/standalone.mjs";
import pluginBabel from "https://unpkg.com/prettier@2.8.5/plugins/babel.mjs";
import pluginHtml from "https://unpkg.com/prettier@2.8.5/plugins/html.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
+1 -1
View File
@@ -142,7 +142,7 @@
"magic-string": "0.30.0",
"npm-run-all": "4.1.5",
"path-browserify": "1.0.1",
"prettier": "2.8.4",
"prettier": "2.8.5",
"pretty-bytes": "6.1.0",
"rollup-plugin-license": "3.0.1",
"semver": "7.3.8",
@@ -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.4/> and
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.4/esm/>
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.5/> and
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.5/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.4/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.4/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.8.5/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.5/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.4/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.8.4/esm/parser-graphql.mjs";
import prettier from "https://unpkg.com/prettier@2.8.5/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.8.5/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.4/standalone.js",
"https://unpkg.com/prettier@2.8.4/parser-graphql.js",
"https://unpkg.com/prettier@2.8.5/standalone.js",
"https://unpkg.com/prettier@2.8.5/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.4/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.4/parser-graphql.js");
importScripts("https://unpkg.com/prettier@2.8.5/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.5/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.4/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.4/esm/parser-babel.mjs";
import prettier from "https://unpkg.com/prettier@2.8.5/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.5/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.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";
import prettier from "https://unpkg.com/prettier@2.8.5/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.5/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.8.5/esm/parser-html.mjs";
console.log(
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -52,7 +52,7 @@ Indent lines with tabs instead of spaces.
Setting `indent_style` in an [`.editorconfig` file](https://editorconfig.org/) will configure Prettier’s tab usage, unless overridden.
(Tabs will be used for _indentation_ but Prettier uses spaces to _align_ things, such as in ternaries.)
(Tabs will be used for _indentation_ but Prettier uses spaces to _align_ things, such as in ternaries. This behavior is known as [SmartTabs](https://www.emacswiki.org/emacs/SmartTabs).)
## Semicolons
+5 -5
View File
@@ -6698,12 +6698,12 @@ __metadata:
languageName: node
linkType: hard
"prettier@npm:2.8.4":
version: 2.8.4
resolution: "prettier@npm:2.8.4"
"prettier@npm:2.8.5":
version: 2.8.5
resolution: "prettier@npm:2.8.5"
bin:
prettier: bin-prettier.js
checksum: c173064bf3df57b6d93d19aa98753b9b9dd7657212e33b41ada8e2e9f9884066bb9ca0b4005b89b3ab137efffdf8fbe0b462785aba20364798ff4303aadda57e
checksum: b7f8d30e14061e0478bc5a59d4d889688d804c173a0daa91b1b85dc08eef5eb6956d1b59f4037770776fda5b967f6c9ca3b7a8a43c50bedb4c7b182029f865aa
languageName: node
linkType: hard
@@ -6807,7 +6807,7 @@ __metadata:
postcss-scss: 4.0.6
postcss-selector-parser: 2.2.3
postcss-values-parser: 2.0.1
prettier: 2.8.4
prettier: 2.8.5
pretty-bytes: 6.1.0
regexp-util: 1.2.2
remark-footnotes: 2.0.0