forked from prettier/prettier
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into update-ignore
- Loading branch information
Showing
121 changed files
with
3,451 additions
and
676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#### 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. | ||
|
||
<!-- prettier-ignore --> | ||
```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); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#### 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 | ||
|
||
<!-- prettier-ignore --> | ||
```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 | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#### 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)) | ||
|
||
<!-- prettier-ignore --> | ||
```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; | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#### 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). | ||
|
||
<!-- prettier-ignore --> | ||
```jsx | ||
// Input | ||
for (const element of list) { /* ... */ } | ||
// ^^^^^^^^^^^^^^^^^^^^^^ ← range | ||
|
||
// Prettier stable | ||
for (const element of list) { /* ... */ } | ||
|
||
// Prettier master | ||
for (const element of list) { | ||
/* ... */ | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#### 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). | ||
|
||
<!-- prettier-ignore --> | ||
```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"; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#### 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** | ||
|
||
<!-- prettier-ignore --> | ||
```js | ||
// Input | ||
#[1, 2, 3] | ||
|
||
// Prettier stable | ||
SyntaxError: Unexpected token (1:1) | ||
> 1 | #[1, 2, 3] | ||
| ^ | ||
|
||
|
||
// Prettier master | ||
#[1, 2, 3]; | ||
``` | ||
|
||
**Records** | ||
|
||
<!-- prettier-ignore --> | ||
```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, | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#### Wrap jsx element on the left of "<" with parentheses ([#8461](https://github.com/prettier/prettier/pull/8461) by [@sosukesuzuki](https://github.com/sosukesuzuki)) | ||
|
||
<!-- prettier-ignore --> | ||
```jsx | ||
// Input | ||
(<div/>) < 5; | ||
|
||
// Prettier stable | ||
<div/> < 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 | <div /> < 5; | ||
| ^ | ||
2 | | ||
|
||
// Prettier master | ||
(<div />) < 5; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#### Fix indentation for binary expressions with trailing comments ([#8476](https://github.com/prettier/prettier/pull/8476) by [@sosukesuzuki](https://github.com/sosukesuzuki)) | ||
|
||
<!-- prettier-ignore --> | ||
```js | ||
// Input | ||
a + | ||
a + // comment | ||
a; | ||
|
||
// Prettier stable | ||
a + | ||
a + // comment | ||
a; | ||
|
||
// Prettier master | ||
a + | ||
a + // comment | ||
a; | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#### Fix unstable comments in binary expressions ([#8491](https://github.com/prettier/prettier/pull/8491) by [@thorn0](https://github.com/thorn0)) | ||
|
||
<!-- prettier-ignore --> | ||
```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 | ||
); | ||
``` | ||
|
||
<!-- prettier-ignore --> | ||
```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; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#### Correctly format CJK sentences with Variation Selector ([#8511](https://github.com/prettier/prettier/pull/8511) by [@ne-sachirou](https://github.com/ne-sachirou)) | ||
|
||
<!-- prettier-ignore --> | ||
```markdown | ||
<!-- Input --> | ||
麻󠄁羽󠄀‼️ | ||
|
||
<!-- Prettier stable --> | ||
麻 󠄁 羽 󠄀 ‼️ | ||
|
||
<!-- Prettier master --> | ||
麻󠄁羽󠄀‼️ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#### Fix inline comments between property and value ([#8366](https://github.com/prettier/prettier/pull/8366) by [@fisker](https://github.com/fisker)) | ||
|
||
<!-- prettier-ignore --> | ||
```scss | ||
// Input | ||
a { | ||
color: // comment | ||
red; | ||
} | ||
|
||
// Prettier stable | ||
a { | ||
color: // comment red; | ||
} | ||
|
||
// Prettier master | ||
a { | ||
color: // comment | ||
red; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#### 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 | ||
|
||
<!-- prettier-ignore --> | ||
```ts | ||
// Input | ||
(a?.b)!.c; | ||
|
||
// Prettier stable | ||
a?.b!.c; | ||
|
||
// Prettier master | ||
(a?.b)!.c; | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.