Skip to content

Commit

Permalink
Merge branch 'next' into remove-webpack
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
#	yarn.lock
  • Loading branch information
fisker committed Nov 9, 2020
2 parents 9763623 + 8616182 commit 8ca5cb7
Show file tree
Hide file tree
Showing 249 changed files with 5,660 additions and 1,774 deletions.
12 changes: 11 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ settings:
import/internal-regex: ^linguist-languages/
rules:
prettier-internal-rules/require-json-extensions: error
prettier-internal-rules/better-parent-property-check-in-needs-parens: error
curly: error
dot-notation: error
eqeqeq:
Expand Down Expand Up @@ -100,3 +99,14 @@ overrides:
- error
- patterns:
- ".."
- files: src/language-js/needs-parens.js
rules:
prettier-internal-rules/better-parent-property-check-in-needs-parens: error
- files: src/**/*.js
rules:
prettier-internal-rules/prefer-fast-path-each: error
- files:
- src/language-js/**/*.js
- src/language-css/**/*.js
rules:
prettier-internal-rules/directly-loc-start-end: error
2 changes: 1 addition & 1 deletion .github/workflows/dev-package-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v2.3.4

- name: Setup Node.js
uses: actions/setup-node@v2.1.2
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/dev-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- master
- patch-release
- next
pull_request:

jobs:
Expand All @@ -28,6 +29,8 @@ jobs:
ENABLE_CODE_COVERAGE: true
FULL_TEST: true
CHECK_TEST_PARSERS: true
- os: "ubuntu-latest"
node: "15"
exclude:
- os: "macos-latest"
node: "12"
Expand All @@ -41,7 +44,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v2.3.4

- name: Setup Node.js
uses: actions/setup-node@v2.1.2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- master
- patch-release
- next
pull_request:

jobs:
Expand All @@ -13,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v2.3.4

- name: Setup Node.js
uses: actions/setup-node@v2.1.2
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/prod-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- master
- patch-release
- next
pull_request:

jobs:
Expand All @@ -13,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v2.3.4

- name: Setup Node.js
uses: actions/setup-node@v2.1.2
Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v2.3.4

- name: Setup Node.js
uses: actions/setup-node@v2.1.2
Expand Down Expand Up @@ -91,6 +92,8 @@ jobs:
- os: "ubuntu-latest"
node: "14"
FULL_TEST: true
- os: "ubuntu-latest"
node: "15"
exclude:
- os: "macos-latest"
node: "12"
Expand All @@ -103,7 +106,7 @@ jobs:
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v2.3.4

- name: Setup Node.js
uses: actions/setup-node@v2.1.2
Expand Down
4 changes: 2 additions & 2 deletions changelog_unreleased/api/pr-8983.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### ESM standalone bundles ([#8983](https://github.com/prettier/prettier/pull/8983) by [@Monchi](https://github.com/Monchi), [@fisker](https://github.com/fisker))
#### [HIGHLIGHT]ESM standalone bundles ([#8983](https://github.com/prettier/prettier/pull/8983) by [@Monchi](https://github.com/Monchi), [@fisker](https://github.com/fisker))

Now standalone is also bundled as ESM. It works directly on browser.
Prettier now also comes as ES modules, which can be directly used in modern browsers:

```js
import prettier from "https://unpkg.com/prettier/esm/standalone.mjs";
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/cli/pr-9298.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Fix error on dir or file that name is a number (#9298 by @fisker)
#### Fix: error on directories and files with numeric names (#9298 by @fisker)

<!-- prettier-ignore -->
```console
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/css/pr-9209.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Improve custom properties format (#9209 by @fisker)
#### Improve formatting for custom properties (#9209 by @fisker)

Thanks to [`PostCSS 8.0`](https://github.com/postcss/postcss/releases/tag/8.0.0), we can handle these edge cases on custom properties.

Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/flow/pr-9432.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Flow Enums with unknown members (#9432 by @gkz)
#### Enums with unknown members (#9432 by @gkz)

Previously, was not supported. Now, the following is formatted:

Expand Down
4 changes: 1 addition & 3 deletions changelog_unreleased/flow/pr-9457.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#### Flow `this` annotations (#9457 by @dsainati1, #9489 by @fisker)

Add support for `this` parameter annotations in Flow.
#### `this` parameter annotations (#9457 by @dsainati1, #9489 by @fisker)

<!-- prettier-ignore -->
```jsx
Expand Down
18 changes: 18 additions & 0 deletions changelog_unreleased/flow/pr-9523.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#### Support `BigIntLiteralTypeAnnotation` and `BigIntTypeAnnotation` (#9523 by @fisker)

Add support for `BigIntLiteralTypeAnnotation` and `BigIntTypeAnnotation` in Flow.

<!-- prettier-ignore -->
```jsx
// Input
const foo: bigint = 1n;
const bar: baz<1n> = 1n;

// Prettier stable
Error: unknown type: "BigIntTypeAnnotation"
at ...

// Prettier master
const foo: bigint = 1n;
const bar: baz<1n> = 1n;
```
25 changes: 25 additions & 0 deletions changelog_unreleased/flow/pr-9543.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#### Treat more simple types as non-breaking in generic type annotations (#9543 by @fisker)

<!-- prettier-ignore -->
```jsx
// Input
const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<symbol> = a
const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a;
const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a;

// Prettier master
const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<
symbol
> = a;
const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<
"STRING"
> = a;
const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<
0
> = a;

// Prettier stable (typescript and flow parser)
const foo1: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<symbol> = a
const foo2: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<"STRING"> = a;
const foo3: Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo<0> = a;
```
22 changes: 22 additions & 0 deletions changelog_unreleased/flow/pr-9553.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#### Fix missing parentheses around `prettier-ignore`d type assertions (#9553 by @fisker)

<!-- prettier-ignore -->
```jsx
// Input
transform(
// prettier-ignore
(pointTransformer: (Point => Point))
);

// Prettier stable
transform(
// prettier-ignore
pointTransformer: (Point => Point)
);

// Prettier master
transform(
// prettier-ignore
(pointTransformer: (Point => Point))
);
```
22 changes: 22 additions & 0 deletions changelog_unreleased/flow/pr-9563.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#### Improve comment types detection (#9563 by @fisker)

<!-- prettier-ignore -->
```jsx
// Input
foo/*::<bar>*/(baz);
class Foo {
bar( data: Array<string>) {}
}

// Prettier master
foo/*:: <bar> */(baz);
class Foo {
bar(data: Array/*:: <string> */) {}
}

// Prettier stable
foo/*:: <bar> */(baz);
class Foo {
bar(data: Array<string>) {}
}
```
10 changes: 7 additions & 3 deletions changelog_unreleased/javascript/pr-9000.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#### Add `espree` parser (#9000 by @fisker)
#### [HIGHLIGHT]Add `espree` and `meriyah` parser (#9000, #9514 by @fisker)

A new value for the `parser` option has been added: [`espree`](https://github.com/eslint/espree) - which is the [`ESLint`](https://github.com/eslint/eslint) default parser.
Two new values for the `parser` option has been added:

Note that `espree` only works for [ECMAScript Finished Proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md), and is stricter than the `babel` parser.
- [`espree`](https://github.com/eslint/espree) - which is the default parser used by [`ESLint`](https://github.com/eslint/eslint).

Note that `espree` only works for [Finished ECMAScript Proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md), and is stricter than the `babel` parser.

- [`meriyah`](https://github.com/meriyah/meriyah) - A [fast](https://meriyah.github.io/meriyah/performance/) JavaScript parser, successor of [cherow](https://github.com/cherow/cherow).
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-9278.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Fix comments inside template (#9278 by @fisker)
#### Fix comments inside template literals with embedded syntax (#9278 by @fisker)

<!-- prettier-ignore -->
```js
Expand Down
4 changes: 2 additions & 2 deletions changelog_unreleased/javascript/pr-9341.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Improve formatting for `AssignmentExpression` with `ClassExpression` that has a long super class (#9341 by @sosukesuzuki)
#### Improve formatting for assignments of classes with long superclass names (#9341 by @sosukesuzuki)

This improves the formatting for [Google Closure Library Namespace](https://developers.google.com/closure/library/docs/introduction#names).
This improves the formatting for [Google Closure Library namespaces](https://developers.google.com/closure/library/docs/introduction#names).

<!-- prettier-ignore -->
```js
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-9345.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Fix placing leading comments for a body of while statement (#9345 by @sosukesuzuki)
#### Fix placement of leading comments for bodies of `while` statements (#9345 by @sosukesuzuki)

<!-- prettier-ignore -->
```js
Expand Down
8 changes: 2 additions & 6 deletions changelog_unreleased/javascript/pr-9408.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Update to `@babel/parser` 7.12 (#9408, #9476 by @sosukesuzuki)
#### Update to `@babel/parser` 7.12 (#9408, #9476, #9597 by @sosukesuzuki)

Updated the JavaScript parser to [`@babel/parser` 7.12](https://babeljs.io/blog/2020/10/15/7.12.0). This fixes several bugs and supports some new syntax.

Expand All @@ -7,15 +7,11 @@ Updated the JavaScript parser to [`@babel/parser` 7.12](https://babeljs.io/blog/
[The "module attributes" proposal supported on 2.1](https://prettier.io/blog/2020/08/24/2.1.0.html#support-es-module-attributes-and-json-modules-8436httpsgithubcomprettierprettierpull8436-by-fiskerhttpsgithubcomfisker) has been significantly changed and also renamed to "import assertions".

```js
import json from "./foo.json" assert { type: "json" };
import foo from "./foo.json" assert { type: "json" };
```

##### Support imports and exports with string names

<!-- TODO: Remove if the bug is fixed -->

Due to a [bug in `@babel/parser`](https://github.com/babel/babel/issues/12209), Prettier can only use exports, but that will be fixed.

```js
let happy = "happy";
export { happy as "😃" };
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-9431.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Keep html and markdown invalid template literals as it is (#9431 by @fisker)
#### Keep HTML and Markdown invalid template literals as is (#9431 by @fisker)

<!-- prettier-ignore -->
```js
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-9435.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Fix `import {a as a}` and `export {a as a}` format (#9435 by @fisker)
#### Fix formatting for `import {a as a}` and `export {a as a}` (#9435 by @fisker)

<!-- prettier-ignore -->
```js
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/markdown/pr-8786.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Fix missing blank lines in fenced code block without end mark ([#8786](https://github.com/prettier/prettier/pull/8786) by [@fisker](https://github.com/fisker))
#### Fix missing blank lines in fenced code blocks lacking the closing fence ([#8786](https://github.com/prettier/prettier/pull/8786) by [@fisker](https://github.com/fisker))

<!-- prettier-ignore -->
```markdown
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/markdown/pr-9275.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Add support for [[wiki-style]] links in markdown (#9275 by @iamrecursion)
#### Add support for `[[wiki-style]]` links (#9275 by @iamrecursion)

1. Support for `[[wiki-style]]` links ensures that they do not get broken by
the prettier formatting by being wrapped over multiple lines.
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/mdx/pr-9267.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Fix JSX format (#9267 by @fisker)
#### Fix extra empty lines in JSX (#9267 by @fisker)

<!-- prettier-ignore -->
```markdown
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/typescript/pr-9318.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Preserve a last separator for ignored object and interface types (#9318 by @sosukesuzuki)
#### Preserve the last separator in ignored object types and interfaces (#9318 by @sosukesuzuki)

<!-- prettier-ignore -->
```ts
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/typescript/pr-9473.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Support TypeScript 4.1 via Babel (#9473 by @sosukesuzuki)
#### [HIGHLIGHT]Support TypeScript 4.1 via Babel (#9473 by @sosukesuzuki)

`--parser=babel-ts` is required.

Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/typescript/pr-9484.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Add parens to object value that it's an assignment (#9484 by @fisker)
#### Add parens around assignments in object literal properties (#9484 by @fisker)

<!-- prettier-ignore -->
```ts
Expand Down
25 changes: 25 additions & 0 deletions changelog_unreleased/typescript/pr-9521.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#### Fix inconsistencies in formatting of types between `typescript` and `flow` (#9521 by @fisker)

<!-- prettier-ignore -->
```ts
// Input
const name: SomeGeneric<
Pick<Config, "ONE_LONG_PROP" | "ANOTHER_LONG_PROP">
> = null;

// Prettier master (--parser=typescript)
const name: SomeGeneric<Pick<
Config,
"ONE_LONG_PROP" | "ANOTHER_LONG_PROP"
>> = null;

// Prettier master (--parser=flow)
const name: SomeGeneric<
Pick<Config, "ONE_LONG_PROP" | "ANOTHER_LONG_PROP">
> = null;

// Prettier stable (typescript and flow parser)
const name: SomeGeneric<
Pick<Config, "ONE_LONG_PROP" | "ANOTHER_LONG_PROP">
> = null;
```
2 changes: 1 addition & 1 deletion changelog_unreleased/vue/pr-9225.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Fix inconsistent `v-for` format (#9225 by @zweimach)
#### Fix inconsistent formatting for `v-for` (#9225 by @zweimach)

<!-- prettier-ignore -->
```vue
Expand Down
Loading

0 comments on commit 8ca5cb7

Please sign in to comment.