Merge branch 'patch-release'

# Conflicts:
#	.git-blame-ignore-revs
#	package.json
#	yarn.lock
This commit is contained in:
fisker committed 2023-03-24 16:24:07 +08:00
commit dd779dae55
11 files changed
+80 -74

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.7
0e26a75ebf0cb5b436f6a2d26a7bb88d04f23b90
# 2.8.6
0461cdd8149f0bb9bb95dfac5faed75b47f77689
# 2.8.5
+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.6**
**Prettier 2.8.7**
[Playground link](https://prettier.io/playground/#.....)
```sh
+1 -1
View File
@@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:
**Environments:**
- Prettier Version: 2.8.6
- Prettier Version: 2.8.7
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
+36
View File
@@ -1,3 +1,39 @@
# 2.8.7
[diff](https://github.com/prettier/prettier/compare/2.8.6...2.8.7)
#### Allow multiple decorators on same getter/setter ([#14584](https://github.com/prettier/prettier/pull/14584) by [@fisker](https://github.com/fisker))
<!-- prettier-ignore -->
```ts
// Input
class A {
@decorator()
get foo () {}
@decorator()
set foo (value) {}
}
// Prettier 2.8.6
SyntaxError: Decorators cannot be applied to multiple get/set accessors of the same name. (5:3)
3 | get foo () {}
4 |
> 5 | @decorator()
| ^^^^^^^^^^^^
6 | set foo (value) {}
7 | }
// Prettier 2.8.7
class A {
@decorator()
get foo() {}
@decorator()
set foo(value) {}
}
```
# 2.8.6
[diff](https://github.com/prettier/prettier/compare/2.8.5...2.8.6)
+15 -15
View File
@@ -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.6/> and
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.6/esm/>
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.7/> and
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.7/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.6/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.6/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.8.7/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.7/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.6/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.8.6/esm/parser-graphql.mjs";
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.8.7/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.6/standalone.js",
"https://unpkg.com/prettier@2.8.6/parser-graphql.js",
"https://unpkg.com/prettier@2.8.7/standalone.js",
"https://unpkg.com/prettier@2.8.7/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.6/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.6/parser-graphql.js");
importScripts("https://unpkg.com/prettier@2.8.7/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.7/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.6/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.6/esm/parser-babel.mjs";
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.7/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.6/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.6/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.8.6/esm/parser-html.mjs";
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.7/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.8.7/esm/parser-html.mjs";
console.log(
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
+1 -1
View File
@@ -133,7 +133,7 @@
"node-fetch": "3.2.10",
"npm-run-all": "4.1.5",
"path-browserify": "1.0.1",
"prettier": "2.8.6",
"prettier": "2.8.7",
"pretty-bytes": "6.0.0",
"rimraf": "3.0.2",
"rollup-plugin-license": "2.7.0",
@@ -57,8 +57,7 @@ function throwErrorForInvalidDecorator(node) {
const { SyntaxKind } = ts;
for (const modifier of modifiers) {
if (ts.isDecorator(modifier)) {
if (!nodeCanBeDecorated(node)) {
if (ts.isDecorator(modifier) && !nodeCanBeDecorated(node)) {
if (
node.kind === SyntaxKind.MethodDeclaration &&
// @ts-expect-error -- internal?
@@ -68,30 +67,10 @@ function throwErrorForInvalidDecorator(node) {
modifier,
"A decorator can only decorate a method implementation, not an overload."
);
} else {
}
throwErrorOnTsNode(modifier, "Decorators are not valid here.");
}
} else if (
node.kind === SyntaxKind.GetAccessor ||
node.kind === SyntaxKind.SetAccessor
) {
// @ts-expect-error -- internal?
const accessors = ts.getAllAccessorDeclarations(
node.parent.members,
node
);
if (
// @ts-expect-error -- internal?
ts.hasDecorators(accessors.firstAccessor) &&
node === accessors.secondAccessor
) {
throwErrorOnTsNode(
modifier,
"Decorators cannot be applied to multiple get/set accessors of the same name."
);
}
}
}
}
}
@@ -30,7 +30,7 @@ exports[`abstract-method.ts [typescript] format 1`] = `
5 |"
`;
exports[`accessor.ts [babel-ts] format 1`] = `
exports[`accessor.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
@@ -56,17 +56,6 @@ class A {
================================================================================
`;
exports[`accessor.ts [typescript] format 1`] = `
"Decorators cannot be applied to multiple get/set accessors of the same name. (4:5)
2 | @foo()
3 | get a() {return 1}
> 4 | @bar()
| ^^^^^^
5 | set a(v) {}
6 | }
7 |"
`;
exports[`argument-list-preserve-line.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
@@ -1,3 +1,3 @@
run_spec(__dirname, ["typescript"], {
errors: { typescript: ["abstract-method.ts", "accessor.ts"] },
errors: { typescript: ["abstract-method.ts"] },
});
@@ -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.6/> and
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.6/esm/>
- `parser-*.js` in <https://unpkg.com/browse/prettier@2.8.7/> and
- `parser-*.mjs` in <https://unpkg.com/browse/prettier@2.8.7/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.6/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.6/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.8.7/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.8.7/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.6/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.8.6/esm/parser-graphql.mjs";
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.8.7/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.6/standalone.js",
"https://unpkg.com/prettier@2.8.6/parser-graphql.js",
"https://unpkg.com/prettier@2.8.7/standalone.js",
"https://unpkg.com/prettier@2.8.7/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.6/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.6/parser-graphql.js");
importScripts("https://unpkg.com/prettier@2.8.7/standalone.js");
importScripts("https://unpkg.com/prettier@2.8.7/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.6/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.6/esm/parser-babel.mjs";
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.7/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.6/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.6/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.8.6/esm/parser-html.mjs";
import prettier from "https://unpkg.com/prettier@2.8.7/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.8.7/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.8.7/esm/parser-html.mjs";
console.log(
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
+4 -4
View File
@@ -5564,10 +5564,10 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==
prettier@2.8.6:
version "2.8.6"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.6.tgz#5c174b29befd507f14b83e3c19f83fdc0e974b71"
integrity sha512-mtuzdiBbHwPEgl7NxWlqOkithPyp4VN93V7VeHVWBF+ad3I5avc0RVDT4oImXQy9H/AqxA2NSQH8pSxHW6FYbQ==
prettier@2.8.7:
version "2.8.7"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.7.tgz#bb79fc8729308549d28fe3a98fce73d2c0656450"
integrity sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==
pretty-bytes@6.0.0:
version "6.0.0"