Release 2.6.2

This commit is contained in:
Sosuke Suzuki committed 2022-04-03 01:31:20 +09:00
1 parent 2bca9d65f4
commit d6f82a024a
8 files changed
+87 -38

No files matched your search

+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.6.1**
**Prettier 2.6.2**
[Playground link](https://prettier.io/playground/#.....)
```sh
+1 -1
View File
@@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:
**Environments:**
- Prettier Version: 2.6.1
- Prettier Version: 2.6.2
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
+58
View File
@@ -1,3 +1,61 @@
# 2.6.2
[diff](https://github.com/prettier/prettier/compare/2.6.1...2.6.2)
#### Fix LESS/SCSS format error ([#12536](https://github.com/prettier/prettier/pull/12536) by [@fisker](https://github.com/fisker))
<!-- prettier-ignore -->
```less
// Input
.background-gradient(@cut) {
background: linear-gradient(
to right,
@white 0%,
@white (@cut - 0.01%),
@portal-background @cut,
@portal-background 100%
);
}
// Prettier 2.6.1
TypeError: Cannot read properties of undefined (reading 'endOffset')
// Prettier 2.6.2
.background-gradient(@cut) {
background: linear-gradient(
to right,
@white 0%,
@white (@cut - 0.01%),
@portal-background @cut,
@portal-background 100%
);
}
```
#### Update `meriyah` to fix several bugs ([#12567](https://github.com/prettier/prettier/pull/12567) by [@fisker](https://github.com/fisker), fixes in [`meriyah`](https://github.com/meriyah/meriyah/) by [@3cp](https://github.com/3cp))
Fixes bugs when parsing following valid code:
```js
foo(await bar());
```
```js
const regex = /.*/ms;
```
```js
const element = <p>{/w/.test(s)}</p>;
```
```js
class A extends B {
#privateMethod() {
super.method();
}
}
```
# 2.6.1
[diff](https://github.com/prettier/prettier/compare/2.6.0...2.6.1)
+13 -13
View File
@@ -32,8 +32,8 @@ See below for examples.
### Global
```html
<script src="https://unpkg.com/prettier@2.6.1/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.6.1/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.6.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.6.2/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.6.1/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.6.1/esm/parser-graphql.mjs";
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.6.2/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.6.1/standalone.js",
"https://unpkg.com/prettier@2.6.1/parser-graphql.js",
"https://unpkg.com/prettier@2.6.2/standalone.js",
"https://unpkg.com/prettier@2.6.2/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.6.1/standalone.js");
importScripts("https://unpkg.com/prettier@2.6.1/parser-graphql.js");
importScripts("https://unpkg.com/prettier@2.6.2/standalone.js");
importScripts("https://unpkg.com/prettier@2.6.2/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.6.1/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.1/esm/parser-babel.mjs";
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.2/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.6.1/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.1/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.6.1/esm/parser-html.mjs";
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.2/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.6.2/esm/parser-html.mjs";
console.log(
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "2.7.0-dev",
"version": "2.6.2",
"description": "Prettier is an opinionated code formatter",
"bin": "./bin/prettier.js",
"repository": "prettier/prettier",
@@ -33,8 +33,8 @@ See below for examples.
### Global
```html
<script src="https://unpkg.com/prettier@2.6.1/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.6.1/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.6.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.6.2/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.6.1/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.6.1/esm/parser-graphql.mjs";
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier@2.6.2/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.6.1/standalone.js",
"https://unpkg.com/prettier@2.6.1/parser-graphql.js",
"https://unpkg.com/prettier@2.6.2/standalone.js",
"https://unpkg.com/prettier@2.6.2/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.6.1/standalone.js");
importScripts("https://unpkg.com/prettier@2.6.1/parser-graphql.js");
importScripts("https://unpkg.com/prettier@2.6.2/standalone.js");
importScripts("https://unpkg.com/prettier@2.6.2/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.6.1/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.1/esm/parser-babel.mjs";
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.2/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.6.1/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.1/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.6.1/esm/parser-html.mjs";
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
import parserBabel from "https://unpkg.com/prettier@2.6.2/esm/parser-babel.mjs";
import parserHtml from "https://unpkg.com/prettier@2.6.2/esm/parser-html.mjs";
console.log(
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -9,7 +9,6 @@ Linters usually contain not only code quality rules, but also stylistic rules. M
Luckily it’s easy to turn off rules that conflict or are unnecessary with Prettier, by using these pre-made configs:
- [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier)
- [tslint-config-prettier](https://github.com/alexjoverm/tslint-config-prettier)
- [stylelint-config-prettier](https://github.com/prettier/stylelint-config-prettier)
Check out the above links for instructions on how to install and set things up.
@@ -21,7 +20,6 @@ When searching for both Prettier and your linter on the Internet you’ll probab
First, we have plugins that let you run Prettier as if it was a linter rule:
- [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier)
- [tslint-plugin-prettier](https://github.com/ikatyang/tslint-plugin-prettier)
- [stylelint-prettier](https://github.com/prettier/stylelint-prettier)
These plugins were especially useful when Prettier was new. By running Prettier inside your linters, you didn’t have to set up any new infrastructure and you could re-use your editor integrations for the linters. But these days you can run `prettier --check .` and most editors have Prettier support.
@@ -35,7 +33,6 @@ The downsides of those plugins are:
Finally, we have tools that run `prettier` and then immediately for example `eslint --fix` on files.
- [prettier-eslint](https://github.com/prettier/prettier-eslint)
- [prettier-tslint](https://github.com/azz/prettier-tslint)
- [prettier-stylelint](https://github.com/hugomrdias/prettier-stylelint)
Those are useful if some aspect of Prettier’s output makes Prettier completely unusable to you. Then you can have for example `eslint --fix` fix that up for you. The downside is that these tools are much slower than just running Prettier.
@@ -17,12 +17,6 @@ original_id: related-projects
- [stylelint-prettier](https://github.com/prettier/stylelint-prettier) runs Prettier as a stylelint rule and reports differences as individual stylelint issues
- [prettier-stylelint](https://github.com/hugomrdias/prettier-stylelint) passes `prettier` output to `stylelint --fix`
## TSLint Integrations
- [tslint-config-prettier](https://github.com/alexjoverm/tslint-config-prettier) use TSLint with Prettier without any conflict
- [tslint-plugin-prettier](https://github.com/ikatyang/tslint-plugin-prettier) runs Prettier as a TSLint rule and reports differences as individual TSLint issues
- [prettier-tslint](https://github.com/azz/prettier-tslint) passes `prettier` output to `tslint --fix`
## Forks
- [prettierx](https://github.com/brodybits/prettierx) less opinionated fork of Prettier