Changelog edits for 2.2 (#9603)
This commit is contained in:
1 parent
1e673a6fed
commit
d6858d52ad
20 files changed
+28
-25
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
#### [HIGHLIGHT]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
|
```js
|
||||||
import prettier from "https://unpkg.com/prettier/esm/standalone.mjs";
|
import prettier from "https://unpkg.com/prettier/esm/standalone.mjs";
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```console
|
```console
|
||||||
|
|||||||
@@ -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.
|
Thanks to [`PostCSS 8.0`](https://github.com/postcss/postcss/releases/tag/8.0.0), we can handle these edge cases on custom properties.
|
||||||
|
|
||||||
|
|||||||
@@ -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:
|
Previously, was not supported. Now, the following is formatted:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#### Flow `this` annotations (#9457 by @dsainati1, #9489 by @fisker)
|
#### `this` parameter annotations (#9457 by @dsainati1, #9489 by @fisker)
|
||||||
|
|
||||||
Add support for `this` parameter annotations in Flow.
|
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
```jsx
|
```jsx
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#### Treat more types as "simple" type (#9543 by @fisker)
|
#### Treat more simple types as non-breaking in generic type annotations (#9543 by @fisker)
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
```jsx
|
```jsx
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#### [HIGHLIGHT]Add `espree` parser (#9000 by @fisker)
|
#### [HIGHLIGHT]Add `espree` parser (#9000 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.
|
A new value for the `parser` option has been added: [`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 [ECMAScript Finished Proposals](https://github.com/tc39/proposals/blob/master/finished-proposals.md), and is stricter than the `babel` parser.
|
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.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#### Fix comments inside template (#9278 by @fisker)
|
#### Fix comments inside template literals with embedded syntax (#9278 by @fisker)
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```js
|
```js
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```markdown
|
```markdown
|
||||||
|
|||||||
@@ -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
|
1. Support for `[[wiki-style]]` links ensures that they do not get broken by
|
||||||
the prettier formatting by being wrapped over multiple lines.
|
the prettier formatting by being wrapped over multiple lines.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#### Fix JSX format (#9267 by @fisker)
|
#### Fix extra empty lines in JSX (#9267 by @fisker)
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
```markdown
|
```markdown
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```ts
|
```ts
|
||||||
|
|||||||
@@ -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 -->
|
<!-- prettier-ignore -->
|
||||||
```ts
|
```ts
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#### Fix inconsistent type format between `typescript` and `flow` (#9521 by @fisker)
|
#### Fix inconsistencies in formatting of types between `typescript` and `flow` (#9521 by @fisker)
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
```ts
|
```ts
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#### Fix inconsistent `v-for` format (#9225 by @zweimach)
|
#### Fix inconsistent formatting for `v-for` (#9225 by @zweimach)
|
||||||
|
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
```vue
|
```vue
|
||||||
|
|||||||
+7
-2
@@ -3,13 +3,18 @@ id: browser
|
|||||||
title: Browser
|
title: Browser
|
||||||
---
|
---
|
||||||
|
|
||||||
Run Prettier in the browser with the `standalone.js` UMD bundle shipped in the NPM package (starting in version 1.13). The UMD bundle only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins.
|
Run Prettier in the browser using its **standalone** version. This version only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins.
|
||||||
|
|
||||||
|
The standalone version comes as:
|
||||||
|
|
||||||
|
- ES modules: `esm/standalone.mjs`, starting in version 2.2
|
||||||
|
- UMD: `standalone.js`, starting in version 1.13
|
||||||
|
|
||||||
The [`browser` field](https://github.com/defunctzombie/package-browser-field-spec) in Prettier’s `package.json` points to `standalone.js`. That’s why you can just `import` or `require` the `prettier` module to access Prettier’s API, and your code can stay compatible with both Node and the browser as long as webpack or another bundler that supports the `browser` field is used. This is especially convenient for [plugins](plugins.md).
|
The [`browser` field](https://github.com/defunctzombie/package-browser-field-spec) in Prettier’s `package.json` points to `standalone.js`. That’s why you can just `import` or `require` the `prettier` module to access Prettier’s API, and your code can stay compatible with both Node and the browser as long as webpack or another bundler that supports the `browser` field is used. This is especially convenient for [plugins](plugins.md).
|
||||||
|
|
||||||
### `prettier.format(code, options)`
|
### `prettier.format(code, options)`
|
||||||
|
|
||||||
Unlike the `format` function from the [main API](api.md#prettierformatsource--options), this function does not load plugins automatically, so a `plugins` property is required if you want to load plugins. Additionally, the parsers included in the Prettier package won’t be loaded automatically, so you need to load them before using them.
|
Unlike the `format` function from the [main API](api.md#prettierformatsource--options), this function does not load plugins automatically, so a `plugins` property is required if you want to load plugins. Additionally, the parsers included in the Prettier package won’t be loaded automatically, so you need to load them as plugins before using them.
|
||||||
|
|
||||||
See [Usage](#usage) below for examples.
|
See [Usage](#usage) below for examples.
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user