Skip to content

Commit

Permalink
Merge branch 'master' of github.com:prettier/prettier into svgo
Browse files Browse the repository at this point in the history
* 'master' of github.com:prettier/prettier: (51 commits)
  Bump @typescript-eslint/typescript-estree from 2.8.0 to 2.9.0 (#7054)
  Bump @babel/preset-react from 7.7.0 to 7.7.4 in /website (#7044)
  Bump @babel/preset-env from 7.7.1 to 7.7.4 in /website (#7045)
  Bump rollup from 1.27.3 to 1.27.5 (#7047)
  Bump @babel/parser from 7.7.3 to 7.7.4 (#7034)
  Bump @babel/preset-env from 7.7.1 to 7.7.4 (#7035)
  Bump resolve from 1.12.0 to 1.12.2 (#7032)
  fix formatting of logical and binary expressions in template literals (#7010)
  Bump docusaurus from 1.14.1 to 1.14.2 in /website (#7030)
  fix unstable formatting of logical expressions (#7026)
  Bump rollup from 1.27.2 to 1.27.3 (#7025)
  TypeScript: print JSDoc-only types (#7020)
  Bump docusaurus from 1.14.0 to 1.14.1 in /website (#7023)
  preserve parentheses for JSDoc type casting with extra spaces a… (#7011)
  Bump rollup from 1.26.3 to 1.27.2 (#7016)
  Ignore test files (#7018)
  Bump @typescript-eslint/typescript-estree from 2.7.0 to 2.8.0 (#7017)
  refactoring: tokens requested from TS parser were immediately dismissed (#7008)
  test: css-in-js (#7005)
  tests(handlebars): Move a test to handlebars folder (#6962)
  ...
  • Loading branch information
lipis committed Nov 26, 2019
2 parents 28944e1 + 3212bb4 commit 9ccde1b
Show file tree
Hide file tree
Showing 85 changed files with 5,863 additions and 1,560 deletions.
5 changes: 5 additions & 0 deletions .github/SECURITY.md
@@ -0,0 +1,5 @@
# Security Policy

## Reporting a Vulnerability

To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
4 changes: 1 addition & 3 deletions .gitignore
Expand Up @@ -3,9 +3,7 @@
/scripts/release/node_modules
*.log
/errors
/test.js
/test.ts
/test.css
/test.*
/.vscode
/dist
/website/node_modules
Expand Down
20 changes: 20 additions & 0 deletions changelog_unreleased/css/pr-6947.md
@@ -0,0 +1,20 @@
#### Don't lowercase element names in CSS selectors ([#6947](https://github.com/prettier/prettier/pull/6947) by [@ark120202](https://github.com/ark120202))

Previously, Prettier already preserved casing of unknown element names, but it did lowercase names of HTML elements.
This caused issues when CSS was applied to a case-sensitive document and an there was an element with the same name as in HTML, which is the case in NativeScript.
Prettier now always preserves original casing.

<!-- prettier-ignore -->
```css
/* Input */
Label {
}

/* Prettier stable */
label {
}

/* Prettier master */
Label {
}
```
23 changes: 23 additions & 0 deletions changelog_unreleased/javascript/pr-6984.md
@@ -0,0 +1,23 @@
#### Fix formatting of labeled statements with comments ([#6994](https://github.com/prettier/prettier/pull/6984) by [@clement26695](https://github.com/clement26695))

Formatting of comments in labeled statements was not stable

<!-- prettier-ignore -->
```jsx
// Input
loop1:
//test
const i = 3;

// Prettier stable (first output)
loop1: //test
const i = 3;

// Prettier stable (second output)
//test
loop1: const i = 3;

// Prettier master (first output)
//test
loop1: const i = 3;
```
28 changes: 28 additions & 0 deletions changelog_unreleased/javascript/pr-7003.md
@@ -0,0 +1,28 @@
#### Fix formatting of logical, binary and sequence expressions in template literals ([#7010](https://github.com/prettier/prettier/pull/7010) by [@evilebottnawi](https://github.com/evilebottnawi))

<!-- prettier-ignore -->
```js
// Input
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo || bar}`;
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo | bar}`;
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${(foo, bar)}`;

// Prettier stable
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo ||
bar}`;
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${foo |
bar}`;
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${(foo,
bar)}`;

// Prettier master
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${
foo || bar
}`;
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${
foo | bar
}`;
`111111111 222222222 333333333 444444444 555555555 666666666 777777777 ${
(foo, bar)
}`;
```
18 changes: 18 additions & 0 deletions changelog_unreleased/javascript/pr-7011.md
@@ -0,0 +1,18 @@
#### Preserve parentheses for JSDoc type casting with extra spaces and asterisk at end ([#7011](https://github.com/prettier/prettier/pull/7011) by [@evilebottnawi](https://github.com/evilebottnawi))

Formatting of comments in labeled statements was not stable

<!-- prettier-ignore -->
```javascript
// Input
const foo = /** @type {!Foo} **/ (baz);
const bar = /** @type {!Foo} * * */(baz);

// Prettier stable
const foo = /** @type {!Foo} **/ baz;
const bar = /** @type {!Foo} * * */ baz;

// Prettier master
const foo = /** @type {!Foo} **/ (baz);
const bar = /** @type {!Foo} * * */ (baz);
```
26 changes: 26 additions & 0 deletions changelog_unreleased/javascript/pr-7026.md
@@ -0,0 +1,26 @@
#### Fix unstable formatting of logical expressions ([#7026](https://github.com/prettier/prettier/pull/7026) by [@thorn0](https://github.com/thorn0))

<!-- prettier-ignore -->
```jsx
// Input
const averredBathersBoxroomBuggyNurl =
bifornCringerMoshedPerplexSawder === 1 ||
(askTrovenaBeenaDependsRowans === 2 || glimseGlyphsHazardNoopsTieTie === 3);

// Prettier stable (first output)
const averredBathersBoxroomBuggyNurl =
bifornCringerMoshedPerplexSawder === 1 ||
askTrovenaBeenaDependsRowans === 2 || glimseGlyphsHazardNoopsTieTie === 3;

// Prettier stable (second output)
const averredBathersBoxroomBuggyNurl =
bifornCringerMoshedPerplexSawder === 1 ||
askTrovenaBeenaDependsRowans === 2 ||
glimseGlyphsHazardNoopsTieTie === 3;

// Prettier master (first output)
const averredBathersBoxroomBuggyNurl =
bifornCringerMoshedPerplexSawder === 1 ||
askTrovenaBeenaDependsRowans === 2 ||
glimseGlyphsHazardNoopsTieTie === 3;
```
19 changes: 19 additions & 0 deletions changelog_unreleased/markdown/pr-6852.md
@@ -0,0 +1,19 @@
#### Handle zero-based lists correctly ([#6852](https://github.com/prettier/prettier/pull/6852) by [@evilebottnawi](https://github.com/evilebottnawi))

<!-- prettier-ignore -->
```md
<!-- Input -->
0. List
1. List
2. List

<!-- Prettier stable -->
0. List
1. List
1. List

<!-- Prettier master -->
0. List
1. List
2. List
```
21 changes: 21 additions & 0 deletions changelog_unreleased/mdx/pr-6398.md
@@ -0,0 +1,21 @@
#### MDX: fix JSX Fragment format incorrectly ([#6398](https://github.com/prettier/prettier/pull/6398) by [@JounQin](https://github.com/JounQin))

Previous versions format JSX Fragment incorrectly in mdx, this has been fixed in this version.

<!-- prettier-ignore -->
```md
<!-- Input -->
<>
test <World /> test
</> 123

<!-- Output (Prettier stable) -->
<>
test <World /> test
</> 123

<!-- Output (Prettier master) -->
<>
test <World /> test
</> 123
```
43 changes: 43 additions & 0 deletions changelog_unreleased/mdx/pr-6949.md
@@ -0,0 +1,43 @@
#### Fix MDX html parsing errors ([#6949](https://github.com/prettier/prettier/pull/6949) by [@Tigge](https://github.com/Tigge) & [@thorn0](https://github.com/thorn0))

MDX parsing for JSX failed when encountering JSX elements that where not
parsable as HTML. Such as `<Tag value={{a: 'b'}}>test</Tag>`

<!-- prettier-ignore -->
````md
<!-- Input -->

<Tag value={ {a : 'b' } }>test</ Tag>

<Foo bg={ 'red' } >
<div style={{ display: 'block'} }>
<Bar >hi </Bar>
{ hello }
{ /* another comment */}
</div>
</Foo>

<!-- Prettier stable -->

```
SyntaxError: Unexpected closing tag "Tag". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (1:35)
> 1 | <Tag value={ {a : 'b' } }>test</ Tag>
| ^
2 |
3 | <Foo bg={ 'red' } >
4 | <div style={{ display: 'block'} }>
```

<!-- Prettier master -->

<Tag value={{ a: "b" }}>test</Tag>

<Foo bg={"red"}>
<div style={{ display: "block" }}>
<Bar>hi </Bar>
{hello}
{/* another comment */}
</div>
</Foo>

````
28 changes: 28 additions & 0 deletions changelog_unreleased/scss/pr-6918.md
@@ -0,0 +1,28 @@
#### Don't add extra comma after last comment in map ([#6918](https://github.com/prettier/prettier/pull/6918) by [@fisker](https://github.com/fisker))

Previously, when `trailingComma` set to `es5`, extra comma added after last comment in map.

<!-- prettier-ignore -->
```scss
// Input
$my-map: (
'foo': 1, // Comment
'bar': 2, // Comment
);

// Prettier stable
$my-map: (
"foo": 1,
// Comment
"bar": 2,
// Comment,
);

// Prettier master
$my-map: (
"foo": 1,
// Comment
"bar": 2,
// Comment
);
```
24 changes: 24 additions & 0 deletions changelog_unreleased/typescript/pr-6901.md
@@ -0,0 +1,24 @@
#### Fix formatting of type operator as arrow function return type ([#6901](https://github.com/prettier/prettier/pull/6901) by [@sosukesuzuki](https://github.com/sosukesuzuki))

<!-- prettier-ignore -->
```ts
// Input
export const getVehicleDescriptor = async (
vehicleId: string
): Promise<
Collections.Parts.PrintedCircuitBoardAssembly["attributes"] & undefined
> => {};

// Prettier stable
export const getVehicleDescriptor = async (
vehicleId: string
): Promise<Collections.Parts.PrintedCircuitBoardAssembly["attributes"] &
undefined> => {};

// Prettier master
export const getVehicleDescriptor = async (
vehicleId: string
): Promise<
Collections.Parts.PrintedCircuitBoardAssembly["attributes"] & undefined
> => {};
```
15 changes: 15 additions & 0 deletions changelog_unreleased/typescript/pr-7020.md
@@ -0,0 +1,15 @@
#### Print JSDoc-only types as is instead of throwing strange errors ([#7020](https://github.com/prettier/prettier/pull/7020) by [@thorn0](https://github.com/thorn0))

<!-- prettier-ignore -->
```jsx
// Input
function fromFlow(arg: ?Maybe) {}

// Prettier stable
Error: unknown type: "TSJSDocNullableType"
at printPathNoParens (https://prettier.io/lib/standalone.js:26012:13)
at Object.genericPrint$3 [as print] (https://prettier.io/lib/standalone.js:23541:28)

// Prettier master
function fromFlow(arg: ?Maybe) {}
```
1 change: 1 addition & 0 deletions cspell.json
Expand Up @@ -348,6 +348,7 @@
"Transloadit",
"TSAs",
"tsep",
"TSJS",
"Typeahead",
"typecasted",
"typeof",
Expand Down
1 change: 1 addition & 0 deletions docs/plugins.md
Expand Up @@ -45,6 +45,7 @@ Providing at least one path to `--plugin-search-dir`/`pluginSearchDirs` turns of
- [`@prettier/plugin-pug`](https://github.com/prettier/plugin-pug) by [**@Shinigami92**](https://github.com/Shinigami92)
- [`@prettier/plugin-ruby`](https://github.com/prettier/plugin-ruby)
- [`@prettier/plugin-swift`](https://github.com/prettier/plugin-swift)
- [`@prettier/plugin-xml`](https://github.com/prettier/plugin-xml)

## Community Plugins

Expand Down
8 changes: 3 additions & 5 deletions docs/rationale.md
Expand Up @@ -130,13 +130,11 @@ class OrderLine {

One final thing: TC39 has [not yet decided if decorators come before or after `export`](https://github.com/tc39/proposal-decorators/issues/69). In the meantime, Prettier supports both:

<!-- prettier-ignore -->
```js
@decorator
export class Foo {}
@decorator export class Foo {}

export
@decorator
class Foo {}
export @decorator class Foo {}
```

### Semicolons
Expand Down

0 comments on commit 9ccde1b

Please sign in to comment.