Skip to content

Commit

Permalink
Merge branch 'master' into update-ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jun 12, 2020
2 parents 50be7b1 + bc3c4eb commit 1fde8cc
Show file tree
Hide file tree
Showing 121 changed files with 3,451 additions and 676 deletions.
49 changes: 49 additions & 0 deletions changelog_unreleased/css/pr-7592.md
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);
}
```
29 changes: 29 additions & 0 deletions changelog_unreleased/css/pr-7844.md
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
);
```
20 changes: 20 additions & 0 deletions changelog_unreleased/css/pr-8535.md
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;
}
```
14 changes: 0 additions & 14 deletions changelog_unreleased/javascript/pr-7787.md

This file was deleted.

18 changes: 18 additions & 0 deletions changelog_unreleased/javascript/pr-8419.md
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) {
/* ... */
}
```
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-8431.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Support Private Fields in `in` ([#8431](https://github.com/prettier/prettier/pull/8431) by [@sosukesuzuki](https://github.com/sosukesuzuki))

Support Stage-1 proposal [Private Fields in `in`](https://github.com/tc39/proposal-private-fields-in-in/blob/master/README.md).
Support Stage-2 proposal [Private Fields in `in`](https://github.com/tc39/proposal-private-fields-in-in/blob/master/README.md).

<!-- prettier-ignore -->
```js
Expand Down
17 changes: 17 additions & 0 deletions changelog_unreleased/javascript/pr-8436.md
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";
```
50 changes: 50 additions & 0 deletions changelog_unreleased/javascript/pr-8453.md
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,
};
```
19 changes: 19 additions & 0 deletions changelog_unreleased/javascript/pr-8461.md
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;
```
20 changes: 20 additions & 0 deletions changelog_unreleased/javascript/pr-8476.md
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;

```
61 changes: 61 additions & 0 deletions changelog_unreleased/javascript/pr-8491.md
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;
```
13 changes: 13 additions & 0 deletions changelog_unreleased/markdown/pr-8511.md
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 -->
麻󠄁羽󠄀‼️
```
21 changes: 21 additions & 0 deletions changelog_unreleased/scss/pr-8366.md
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;
}
```
16 changes: 16 additions & 0 deletions changelog_unreleased/typescript/pr-8450.md
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;

```
2 changes: 1 addition & 1 deletion commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ declare function markAsRoot(doc: Doc): Doc;

This marks the current indentation as root for `dedentToRoot` and `literalline`s.

#### dedentToRoot
### dedentToRoot

```ts
declare function dedentToRoot(doc: Doc): Doc;
Expand Down
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
],
"ignoreRegExpList": [
"<!-- prettier-ignore -->\\n(`{3,})\\w*\\n[\\s\\S]+?\\1",
"\\[(\\*{2})?@\\w+?\\1\\]",
"\\[(\\*{2})?@[-\\w]+?\\1\\]",
"\\[`\\w+`\\]",
"ve{2,}r{2,}y",
"ve+r+y+long\\w*",
Expand Down
Binary file removed docs/assets/webstorm/file-watcher-prettier.png
Binary file not shown.
Loading

0 comments on commit 1fde8cc

Please sign in to comment.