Release 3.3.3

This commit is contained in:
Sosuke Suzuki committed 2024-07-13 21:24:55 +09:00
1 parent 9102b73d8c
commit 52829385bc
8 files changed
+87 -25

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you:
-->
**Prettier 3.3.2**
**Prettier 3.3.3**
[Playground link](https://prettier.io/playground/#.....)
```sh
+1 -1
View File
@@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:
**Environments:**
- Prettier Version: 3.3.2
- Prettier Version: 3.3.3
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->
+63
View File
@@ -1,3 +1,66 @@
# 3.3.3
[diff](https://github.com/prettier/prettier/compare/3.3.2...3.3.3)
#### Add parentheses for nullish coalescing in ternary ([#16391](https://github.com/prettier/prettier/pull/16391) by [@cdignam-segment](https://github.com/cdignam-segment))
This change adds clarity to operator precedence.
<!-- prettier-ignore -->
```js
// Input
foo ? bar ?? foo : baz;
foo ?? bar ? a : b;
a ? b : foo ?? bar;
// Prettier 3.3.2
foo ? bar ?? foo : baz;
foo ?? bar ? a : b;
a ? b : foo ?? bar;
// Prettier 3.3.3
foo ? (bar ?? foo) : baz;
(foo ?? bar) ? a : b;
a ? b : (foo ?? bar);
```
#### Add parentheses for decorator expressions ([#16458](https://github.com/prettier/prettier/pull/16458) by [@y-schneider](https://github.com/y-schneider))
Prevent parentheses around member expressions or tagged template literals from being removed to follow the stricter parsing rules of TypeScript 5.5.
<!-- prettier-ignore -->
```ts
// Input
@(foo`tagged template`)
class X {}
// Prettier 3.3.2
@foo`tagged template`
class X {}
// Prettier 3.3.3
@(foo`tagged template`)
class X {}
```
#### Support `@let` declaration syntax ([#16474](https://github.com/prettier/prettier/pull/16474) by [@sosukesuzuki](https://github.com/sosukesuzuki))
Adds support for Angular v18 `@let` declaration syntax.
Please see the following code example. The `@let` declaration allows you to define local variables within the template:
<!-- prettier-ignore -->
```html
@let name = 'Frodo';
<h1>Dashboard for {{name}}</h1>
Hello, {{name}}
```
For more details, please refer to the excellent blog post by the Angular Team: [Introducing @let in Angular](https://blog.angular.dev/introducing-let-in-angular-686f9f383f0f).
We also appreciate the Angular Team for kindly answering our questions to implement this feature.
# 3.3.2
[diff](https://github.com/prettier/prettier/compare/3.3.1...3.3.2)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "3.4.0-dev",
"version": "3.3.3",
"description": "Prettier is an opinionated code formatter",
"bin": "./bin/prettier.cjs",
"repository": "prettier/prettier",
@@ -19,7 +19,7 @@ Required options:
- **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use.
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in <https://unpkg.com/browse/prettier@3.3.2/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in <https://unpkg.com/browse/prettier@3.3.3/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
@@ -30,8 +30,8 @@ See below for examples.
### Global
```html
<script src="https://unpkg.com/prettier@3.3.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.3.2/plugins/graphql.js"></script>
<script src="https://unpkg.com/prettier@3.3.3/standalone.js"></script>
<script src="https://unpkg.com/prettier@3.3.3/plugins/graphql.js"></script>
<script>
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
@@ -48,8 +48,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.3.2/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.3.2/plugins/graphql.mjs";
import * as prettier from "https://unpkg.com/prettier@3.3.3/standalone.mjs";
import prettierPluginGraphql from "https://unpkg.com/prettier@3.3.3/plugins/graphql.mjs";
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -62,8 +62,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
```js
define([
"https://unpkg.com/prettier@3.3.2/standalone.js",
"https://unpkg.com/prettier@3.3.2/plugins/graphql.js",
"https://unpkg.com/prettier@3.3.3/standalone.js",
"https://unpkg.com/prettier@3.3.3/plugins/graphql.js",
], async (prettier, ...plugins) => {
const formatted = await prettier.format("type Query { hello: String }", {
parser: "graphql",
@@ -91,8 +91,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
### Worker
```js
importScripts("https://unpkg.com/prettier@3.3.2/standalone.js");
importScripts("https://unpkg.com/prettier@3.3.2/plugins/graphql.js");
importScripts("https://unpkg.com/prettier@3.3.3/standalone.js");
importScripts("https://unpkg.com/prettier@3.3.3/plugins/graphql.js");
(async () => {
const formatted = await prettier.format("type Query { hello: String }", {
@@ -108,9 +108,9 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.3.2/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.3.2/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.3.2/plugins/estree.mjs";
import * as prettier from "https://unpkg.com/prettier@3.3.3/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.3.3/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.3.3/plugins/estree.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -126,10 +126,10 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
```html
<script type="module">
import * as prettier from "https://unpkg.com/prettier@3.3.2/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.3.2/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.3.2/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.3.2/plugins/html.mjs";
import * as prettier from "https://unpkg.com/prettier@3.3.3/standalone.mjs";
import prettierPluginBabel from "https://unpkg.com/prettier@3.3.3/plugins/babel.mjs";
import prettierPluginEstree from "https://unpkg.com/prettier@3.3.3/plugins/estree.mjs";
import prettierPluginHtml from "https://unpkg.com/prettier@3.3.3/plugins/html.mjs";
console.log(
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -203,11 +203,11 @@ You can also switch to the `flow` parser instead of the default `babel` for .js
## Configuration Schema
If you’d like a JSON schema to validate your configuration, one is available here: https://json.schemastore.org/prettierrc.
If you’d like a JSON schema to validate your configuration, one is available here: <https://json.schemastore.org/prettierrc>.
## EditorConfig
If `options.editorconfig` is `true` and an [`.editorconfig` file](https://editorconfig.org/) is in your project, Prettier will parse it and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by `.prettierrc`, etc.
If a [`.editorconfig` file](https://editorconfig.org/) is in your project, Prettier will parse it and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by `.prettierrc`, etc.
Here’s an annotated description of how different properties map to Prettier’s behavior:
@@ -48,10 +48,8 @@ node --eval "fs.writeFileSync('.prettierrc','{}\n')"
Next, create a [.prettierignore](ignore.md) file to let the Prettier CLI and editors know which files to _not_ format. Here’s an example:
```text
# Ignore artifacts:
build
coverage
```bash
node --eval "fs.writeFileSync('.prettierignore','# Ignore artifacts:\nbuild\ncoverage\n')"
```
> Tip! Prettier will follow rules specified in .gitignore if it exists in the same directory from which it is run. You can also base your .prettierignore on .eslintignore (if you have one).
@@ -31,3 +31,4 @@ original_id: related-projects
- [prettier-chrome](https://github.com/u3u/prettier-chrome) is an extension that runs Prettier in the browser
- [spotless](https://github.com/diffplug/spotless) lets you run prettier from [gradle](https://github.com/diffplug/spotless/tree/main/plugin-gradle#prettier) or [maven](https://github.com/diffplug/spotless/tree/main/plugin-maven#prettier).
- [csharpier](https://github.com/belav/csharpier) is a port of Prettier for C#
- [reviewdog-action-prettier](https://github.com/EPMatt/reviewdog-action-prettier) runs Prettier in GitHub Actions CI/CD workflows