Skip to content

Commit

Permalink
Release 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Nov 20, 2020
1 parent 9bc90cf commit 42b2195
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Tip! Don't write this stuff manually.
-->

**Prettier 2.1.2**
**Prettier 2.2.0**
[Playground link](https://prettier.io/playground/#.....)

```sh
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:

**Environments:**

- Prettier Version: 2.1.2
- Prettier Version: 2.2.0
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.2.0

[diff](https://github.com/prettier/prettier/compare/2.1.2...2.2.0)

🔗 [Release Notes](https://prettier.io/blog/2020/11/20/2.2.0.html)

# 2.1.2

[diff](https://github.com/prettier/prettier/compare/2.1.1...2.1.2)
Expand Down
12 changes: 6 additions & 6 deletions docs/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ See [Usage](#usage) below for examples.
### Global

```html
<script src="https://unpkg.com/prettier@2.1.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.1.2/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.2.0/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.2.0/parser-graphql.js"></script>
<script>
prettier.format("query { }", {
parser: "graphql",
Expand All @@ -51,8 +51,8 @@ prettier.format("query { }", {

```js
define([
"https://unpkg.com/prettier@2.1.2/standalone.js",
"https://unpkg.com/prettier@2.1.2/parser-graphql.js",
"https://unpkg.com/prettier@2.2.0/standalone.js",
"https://unpkg.com/prettier@2.2.0/parser-graphql.js",
], (prettier, ...plugins) => {
prettier.format("query { }", { parser: "graphql", plugins });
});
Expand All @@ -71,7 +71,7 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
### Worker

```js
importScripts("https://unpkg.com/prettier@2.1.2/standalone.js");
importScripts("https://unpkg.com/prettier@2.1.2/parser-graphql.js");
importScripts("https://unpkg.com/prettier@2.2.0/standalone.js");
importScripts("https://unpkg.com/prettier@2.2.0/parser-graphql.js");
prettier.format("query { }", { parser: "graphql", plugins: prettierPlugins });
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "2.2.0-dev",
"version": "2.2.0",
"description": "Prettier is an opinionated code formatter",
"bin": "./bin/prettier.js",
"repository": "prettier/prettier",
Expand Down
25 changes: 15 additions & 10 deletions website/versioned_docs/version-stable/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ title: Browser
original_id: 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).

### `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.

Expand All @@ -19,8 +24,8 @@ See [Usage](#usage) below for examples.
### Global

```html
<script src="https://unpkg.com/prettier@2.1.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.1.2/parser-graphql.js"></script>
<script src="https://unpkg.com/prettier@2.2.0/standalone.js"></script>
<script src="https://unpkg.com/prettier@2.2.0/parser-graphql.js"></script>
<script>
prettier.format("query { }", {
parser: "graphql",
Expand All @@ -34,8 +39,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
### ES Modules

```js
import prettier from "prettier/standalone";
import parserGraphql from "prettier/parser-graphql";
import prettier from "https://unpkg.com/prettier/esm/standalone.mjs";
import parserGraphql from "https://unpkg.com/prettier/esm/parser-graphql.mjs";

prettier.format("query { }", {
parser: "graphql",
Expand All @@ -47,8 +52,8 @@ prettier.format("query { }", {

```js
define([
"https://unpkg.com/prettier@2.1.2/standalone.js",
"https://unpkg.com/prettier@2.1.2/parser-graphql.js",
"https://unpkg.com/prettier@2.2.0/standalone.js",
"https://unpkg.com/prettier@2.2.0/parser-graphql.js",
], (prettier, ...plugins) => {
prettier.format("query { }", { parser: "graphql", plugins });
});
Expand All @@ -67,7 +72,7 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
### Worker

```js
importScripts("https://unpkg.com/prettier@2.1.2/standalone.js");
importScripts("https://unpkg.com/prettier@2.1.2/parser-graphql.js");
importScripts("https://unpkg.com/prettier@2.2.0/standalone.js");
importScripts("https://unpkg.com/prettier@2.2.0/parser-graphql.js");
prettier.format("query { }", { parser: "graphql", plugins: prettierPlugins });
```
1 change: 1 addition & 0 deletions website/versioned_docs/version-stable/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ Valid options:
- `"babel-ts"` (similar to `"typescript"` but uses Babel and its TypeScript plugin) _First available in v2.0.0_
- `"flow"` (via [flow-parser](https://github.com/facebook/flow/tree/master/src/parser))
- `"typescript"` (via [@typescript-eslint/typescript-estree](https://github.com/typescript-eslint/typescript-eslint)) _First available in v1.4.0_
- `"espree"` (via [espree](https://github.com/eslint/espree)) _First available in v2.2.0_

This comment has been minimized.

Copy link
@fisker

fisker Nov 20, 2020

Member

Did I forgot add meriyah?

This comment has been minimized.

Copy link
@sosukesuzuki

sosukesuzuki Nov 20, 2020

Author Member

Or, I mistook some rebasing..

This comment has been minimized.

Copy link
@fisker

fisker Nov 20, 2020

Member

Can you add it?

This comment has been minimized.

Copy link
@sosukesuzuki

sosukesuzuki Nov 20, 2020

Author Member

There is no change for options.md on https://github.com/prettier/prettier/pull/9514/files. Can you add?

This comment has been minimized.

Copy link
@fisker

fisker Nov 20, 2020

Member

I think I forgot

This comment has been minimized.

Copy link
@fisker

fisker Nov 20, 2020

Member

WIP

- `"css"` (via [postcss-scss](https://github.com/postcss/postcss-scss) and [postcss-less](https://github.com/shellscape/postcss-less), autodetects which to use) _First available in v1.7.1_
- `"scss"` (same parsers as `"css"`, prefers postcss-scss) _First available in v1.7.1_
- `"less"` (same parsers as `"css"`, prefers postcss-less) _First available in v1.7.1_
Expand Down
10 changes: 9 additions & 1 deletion website/versioned_docs/version-stable/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,27 @@ Providing at least one path to `--plugin-search-dir`/`pluginSearchDirs` turns of

- [`prettier-plugin-apex`](https://github.com/dangmai/prettier-plugin-apex) by [**@dangmai**](https://github.com/dangmai)
- [`prettier-plugin-elm`](https://github.com/gicentre/prettier-plugin-elm) by [**@giCentre**](https://github.com/gicentre)
- [`prettier-plugin-go-template`](https://github.com/NiklasPor/prettier-plugin-go-template) by [**@NiklasPor**](https://github.com/NiklasPor)
- [`prettier-plugin-java`](https://github.com/jhipster/prettier-java) by [**@JHipster**](https://github.com/jhipster)
- [`prettier-plugin-jsdoc`](https://github.com/hosseinmd/prettier-plugin-jsdoc) by [**@hosseinmd**](https://github.com/hosseinmd)
- [`prettier-plugin-kotlin`](https://github.com/Angry-Potato/prettier-plugin-kotlin) by [**@Angry-Potato**](https://github.com/Angry-Potato)
- [`prettier-plugin-package`](https://github.com/shellscape/prettier-plugin-package) by [**@shellscape**](https://github.com/shellscape)
- [`prettier-plugin-packagejson`](https://github.com/matzkoh/prettier-plugin-packagejson) by [**@matzkoh**](https://github.com/matzkoh)
- [`prettier-plugin-pg`](https://github.com/benjie/prettier-plugin-pg) by [**@benjie**](https://github.com/benjie)
- [`prettier-plugin-properties`](https://github.com/eemeli/prettier-plugin-properties) by [**@eemeli**](https://github.com/eemeli)
- [`prettier-plugin-solidity`](https://github.com/prettier-solidity/prettier-plugin-solidity) by [**@mattiaerre**](https://github.com/mattiaerre)
- [`prettier-plugin-svelte`](https://github.com/UnwrittenFun/prettier-plugin-svelte) by [**@UnwrittenFun**](https://github.com/UnwrittenFun)
- [`prettier-plugin-tailwind`](https://github.com/Acidic9/prettier-plugin-tailwind) by [**@Acidic9**](https://github.com/Acidic9)
- [`prettier-plugin-toml`](https://github.com/bd82/toml-tools/tree/master/packages/prettier-plugin-toml) by [**@bd82**](https://github.com/bd82)
- [`prettier-plugin-organize-imports`](https://github.com/simonhaenisch/prettier-plugin-organize-imports) by [**@simonhaenisch**](https://github.com/simonhaenisch)
- [`prettier-plugin-pkg`](https://github.com/rx-ts/prettier/tree/master/packages/pkg) by [**@JounQin**](https://github.com/JounQin)
- [`prettier-plugin-sh`](https://github.com/rx-ts/prettier/tree/master/packages/sh) by [**@JounQin**](https://github.com/JounQin)

## Experimental Plugins

These plugins provide functionality not supported with Plugin API. Use with caution.

- [`prettier-plugin-organize-imports`](https://github.com/simonhaenisch/prettier-plugin-organize-imports) by [**@simonhaenisch**](https://github.com/simonhaenisch)

## Developing Plugins

Prettier plugins are regular JavaScript modules with five exports:
Expand Down
2 changes: 0 additions & 2 deletions website/versioned_docs/version-stable/precommit.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ Copy the following config into your `.pre-commit-config.yaml` file:

Read more at [mirror of prettier package for pre-commit](https://github.com/pre-commit/mirrors-prettier) and the [pre-commit](https://pre-commit.com) website.

Read more at the [pre-commit](https://pre-commit.com) website.

## Option 4. [git-format-staged](https://github.com/hallettj/git-format-staged)

**Use Case:** Great for when you want to format partially-staged files, and other options do not provide a good fit for your project.
Expand Down

0 comments on commit 42b2195

Please sign in to comment.