Clean changelog_unreleased

This commit is contained in:
fisker committed 2026-06-27 18:33:45 +08:00
1 parent 79f6cdfd98
commit 05cf896cfc
104 files changed
-2472

No files matched your search

-29
View File
@@ -1,29 +0,0 @@
#### Support `@content` block (#19431 by @fisker)
<!-- prettier-ignore -->
```html
<!-- Input -->
<FancyButton [label]="title">
@content(icon) {
<span>Icon</span>
}
@content(description) {
<span>Description text</span>
}
<span>Other children</span>
</FancyButton>
<!-- Prettier stable -->
SyntaxError: Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) (9:15)
<!-- Prettier main -->
<FancyButton [label]="title">
@content(icon) {
<span>Icon!</span>
}
@content(description) {
<span>Description text</span>
}
<span>Other children</span>
</FancyButton>
```
-31
View File
@@ -1,31 +0,0 @@
#### Support comments in html element (#19465 by @fisker)
<!-- prettier-ignore -->
```html
<!-- Input -->
<div
// comment 0
/* comment 1 */
attr1="value1"
/*
comment 2
spanning multiple lines
*/
attr2="value2"
></div>
<!-- Prettier stable -->
<div attr1="value1" attr2="value2"></div>
<!-- Prettier main -->
<div
// comment 0
/* comment 1 */
attr1="value1"
/*
comment 2
spanning multiple lines
*/
attr2="value2"
></div>
```
-18
View File
@@ -1,18 +0,0 @@
---
authors: "fisker"
title: "Prettier 3.9: New Parser Foundations and Formatting Improvements"
---
We are excited to announce Prettier 3.9!
This release brings major parser upgrades for Markdown, YAML, Flow, GraphQL, and Angular, along with formatting improvements for JavaScript and TypeScript (particularly in `--no-semi` mode).
If you find Prettier valuable, please consider [sponsoring us on OpenCollective](https://opencollective.com/prettier) or supporting the upstream projects we rely on. Your contributions help us keep improving the tool for everyone.
Thank you for your continued support! ❤️
A reminder, when Prettier is installed or updated, it’s [strongly recommended](https://prettier.io/docs/install#summary) to specify the exact version in `package.json`: `"prettier": "3.9.0"`, not `"prettier": "^3.9.0"`.
If you use [`@prettier/plugin-oxc`](https://www.npmjs.com/package/@prettier/plugin-oxc) or [`@prettier/plugin-hermes`](https://www.npmjs.com/package/@prettier/plugin-hermes), don't forget upgrade them to ensure the new formatting rules are applied.
<!-- truncate -->
-15
View File
@@ -1,15 +0,0 @@
#### Fix crashes on formatting directory names that have special characters (#18452 by @fisker)
<!-- prettier-ignore -->
```sh
prettier . --check
# Prettier stable
[error] Invalid configuration for file "<CWD>\test\username[repo-name]\.editorconfig":
[error] Invalid regular expression: /^(?=.)username[repo-name]$/: Range out of order in character class
# Prettier main
Checking formatting...
[warn] test/username[repo-name]/test.js
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
```
-3
View File
@@ -1,3 +0,0 @@
#### Stop searching for EditorConfig files above Git worktrees (#18891 by @seiyab)
Prettier now treats a `.git` file as a project root marker, in addition to a `.git` directory. This prevents EditorConfig settings from a parent directory from being applied when formatting files inside Git worktrees or submodules.
-3
View File
@@ -1,3 +0,0 @@
#### Fix `--cache-strategy content` not working (#18914 by @paulofduarte)
`file-entry-cache` v11 renamed the `useChecksum` option to `useCheckSum`. Prettier was still passing the old casing, so content-based cache comparison was silently disabled and only file size was compared.
-15
View File
@@ -1,15 +0,0 @@
#### Fix formatting file with a leading quote (`"`) in the name (#19315 by @kovsu)
<!-- prettier-ignore -->
```console
prettier --check '".md'
# Prettier stable
Checking formatting...
[error] Explicitly specified file was ignored due to negative glob patterns: "".md".
# Prettier main
Checking formatting...
[warn] ".md
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
```
-6
View File
@@ -1,6 +0,0 @@
#### Update experimental cli (#19381, #19415 by @Simomson, @43081j, @fisker)
Full changelog:
- [v0.11.0](https://github.com/prettier/prettier-cli/releases/tag/v0.11.0)
- [v0.12.0](https://github.com/prettier/prettier-cli/releases/tag/v0.12.0)
-20
View File
@@ -1,20 +0,0 @@
#### Fix line breaks when css attribute values contain literal newlines (#18605 by @kovsu)
<!-- prettier-ignore -->
```css
/* Input */
div span[foo="a long long long long long long long long\
long long long long attritbute value"] {
}
/* Prettier stable */
div
span[foo="a long long long long long long long long\
long long long long attritbute value"] {
}
/* Prettier main */
div span[foo="a long long long long long long long long\
long long long long attritbute value"] {
}
```
-19
View File
@@ -1,19 +0,0 @@
#### Fix parenthesis for optional function as return type (#11004, #19331 by @vjeux, @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const fn = (a: number): ?((string) => string) => {
return a > 0 ? (s) => `${s}: ${a}` : null;
};
// Prettier stable
const fn = (a: number): ?(string) => string => {
return a > 0 ? (s) => `${s}: ${a}` : null;
};
// Prettier main
const fn = (a: number): ?((string) => string) => {
return a > 0 ? (s) => `${s}: ${a}` : null;
};
```
-23
View File
@@ -1,23 +0,0 @@
#### Add support for Flow match instance patterns and Flow records (#18511 by @gkz)
<!-- prettier-ignore -->
```flow
// Input
record R {
num: number,
}
const x = R {num: 1};
const label = match (x) {
R {num: 0} => "zero",
R {num: 1} => "one",
R {const num} => `${num} items`,
}
// Prettier stable
// Unsupported
// Prettier main
// Same as input
```
-23
View File
@@ -1,23 +0,0 @@
#### Improve comment format in inexact tuples (#18616 by @fisker)
<!-- prettier-ignore -->
```flow
// Input
type A = [// comment
...];
type B = [/* comment */...];
// Prettier stable
type A = [...
// comment
];
type B = [...
/* comment */
];
// Prettier main
type A = [
...// comment
];
type B = [.../* comment */];
```
-21
View File
@@ -1,21 +0,0 @@
#### Fix dangling comment print in components (#18629 by @fisker)
<!-- prettier-ignore -->
```flow
// Input
component A(
// comment
) {}
component B(/* comment */) {}
// Prettier stable
component A() // comment
{}
component B /* comment */() {}
// Prettier main
component A(
// comment
) {}
component B(/* comment */) {}
```
-32
View File
@@ -1,32 +0,0 @@
#### Fix dangling comment print in hooks (#18630 by @fisker)
<!-- prettier-ignore -->
```flow
// Input
hook A(
// comment
) {}
declare hook B(// comment
): void
type C = hook (// comment
)=> void
// Prettier stable
hook A() // comment
{}
declare hook B(): // comment
void;
type C = hook () => // comment
void;
// Prettier main
hook A(
// comment
) {}
declare hook B(
// comment
): void;
type C = hook (
// comment
) => void;
```
-16
View File
@@ -1,16 +0,0 @@
#### Support implicit declared functions and components (#18690 by @fisker)
<!-- prettier-ignore -->
```flow
// Input
declare module "foo" {
function greet(name: string): string;
component Button(label: string);
}
// Prettier stable
SyntaxError: Unexpected token `;`, expected the token `{` (2:39)
// Prettier main
<Same as input>
```
-25
View File
@@ -1,25 +0,0 @@
#### Improve long mapped type to across multiple line (#18779 by @kovsu)
<!-- prettier-ignore -->
```flow
// Input
type MappedType = {
[KeyType in ValueType extends string ? VeryLongStringTypeNameHere : VeryLongNumberTypeNameHere]: KeyType
}
// Prettier stable
type MappedType = {
[KeyType in ValueType extends string
? VeryLongStringTypeNameHere
: VeryLongNumberTypeNameHere]: KeyType,
};
// Prettier main
type MappedType = {
[
KeyType in ValueType extends string
? VeryLongStringTypeNameHere
: VeryLongNumberTypeNameHere
]: KeyType,
};
```
-16
View File
@@ -1,16 +0,0 @@
#### Add parentheses support for `keyof` type operator (#18801 by @marcoww6)
<!-- prettier-ignore -->
```flow
// Input
type T1 = (keyof Foo)[];
type T2 = (keyof Foo)["bar"];
// Prettier stable
type T1 = keyof Foo[];
type T2 = keyof Foo["bar"];
// Prettier main
type T1 = (keyof Foo)[];
type T2 = (keyof Foo)["bar"];
```
-15
View File
@@ -1,15 +0,0 @@
#### Support literal initializers and multiple declarations in `DeclareVariable` (#18929 by @fisker)
<!-- prettier-ignore -->
```flow
// Input
declare const x: string, y: number;
declare const s = 'foo';
// Prettier stable
SyntaxError: Unexpected token `,`, expected the token `;` (1:24)
// Prettier main
declare const x: string, y: number;
declare const s = "foo";
```
-13
View File
@@ -1,13 +0,0 @@
#### Print `async` keyword for component declarations (#19053 by @mvitousek)
<!-- prettier-ignore -->
```flow
// Input
async component MyAsyncComponent() {}
// Prettier stable
component MyAsyncComponent() {}
// Prettier main
async component MyAsyncComponent() {}
```
-19
View File
@@ -1,19 +0,0 @@
#### Add support for `writeonly`, `in`, and `out` variance modifiers (#19102 by @marcoww6)
Support new Flow variance syntax: `writeonly` on object type properties/indexers, and `in T`/`out T` on type parameters.
<!-- prettier-ignore -->
```jsx
// Input
type T = {writeonly foo: string};
type Contravariant<in T> = T;
type Covariant<out T> = T;
// Prettier stable
// SyntaxError
// Prettier main
type T = { writeonly foo: string };
type Contravariant<in T> = T;
type Covariant<out T> = T;
```
-15
View File
@@ -1,15 +0,0 @@
#### Do not expand object type with inline comments (#19287 by @fisker)
<!-- prettier-ignore -->
```flow
// Input
type T = {|/* comment */|};
// Prettier stable
type T = {|
/* comment */
|};
// Prettier main
type T = {| /* comment */ |};
```
-15
View File
@@ -1,15 +0,0 @@
#### Preserve Flow comment syntax (#19398 by @SamChou19815)
Preserves Flow comment syntax annotations instead of printing them as regular Flow syntax.
<!-- prettier-ignore -->
```flow
// Input
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
// Prettier stable
function foo<T>(bar: T[], baz: T): S {}
// Prettier main
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
```
-5
View File
@@ -1,5 +0,0 @@
#### [HIGHLIGHT] New Rust-based Flow parser (#19398 by @SamChou19815)
Prettier now uses the new Rust-based Flow parser (oxidized) released by the Flow team, which improves performance for Flow-typed code.
In local parser-only benchmarks, `flow-parser/oxidized` parsed Prettier's valid Flow fixtures in 266.4ms median time, compared with 422.6ms for the old parser, and parsed `flow_parser.js` in 1298.0ms, compared with 2269.6ms.
-27
View File
@@ -1,27 +0,0 @@
#### Fix crash with comment only object value (#18581 by @fisker)
<!-- prettier-ignore -->
```gql
# Input
query {
search(filters: {
# TODO
}) {
id
}
}
# Prettier stable
Error: Comment "TODO" was not printed. Please report this error!
# Prettier main
query {
search(
filters: {
# TODO
}
) {
id
}
}
```
-24
View File
@@ -1,24 +0,0 @@
#### Allow interfaces to break (#18582 by @fisker)
<!-- prettier-ignore -->
```gql
# Input
type Foo implements InterfaceOne & InterfaceTwo & InterfaceThree & InterfaceFour & InterfaceFive & InterfaceSix {
id: ID!
}
# Prettier stable
type Foo implements InterfaceOne & InterfaceTwo & InterfaceThree & InterfaceFour & InterfaceFive & InterfaceSix {
id: ID!
}
# Prettier main
type Foo implements InterfaceOne &
InterfaceTwo &
InterfaceThree &
InterfaceFour &
InterfaceFive &
InterfaceSix {
id: ID!
}
```
-37
View File
@@ -1,37 +0,0 @@
#### [HIGHLIGHT] Support GraphQL.js v17 (#19171 by @YBJ0000, #19297 by @fisker)
Prettier now fully supports newer syntax features from GraphQL.js v17, including directives on directive definitions, fragment arguments, and other enhancements.
[Fragment arguments](https://github.com/graphql/graphql-js/pull/4015)
<!-- prettier-ignore -->
```gql
# Input
fragment variableProfilePic on User {
...dynamicProfilePic(size: $size)
}
# Prettier stable
SyntaxError: Syntax Error: Expected Name, found "(". (2:23)
# Prettier main
fragment variableProfilePic on User {
...dynamicProfilePic(size: $size)
}
```
[Directives on directive definitions](https://github.com/graphql/graphql-js/pull/4521) (and `extend directive` extensions)
<!-- prettier-ignore -->
```gql
# Input
directive @a @b on QUERY
extend directive @a @b
# Prettier stable
Error: Syntax Error: Expected "on", found "@".
# Prettier main
directive @a @b on QUERY
extend directive @a @b
```
-23
View File
@@ -1,23 +0,0 @@
#### Fix crash with comment only list value (#19422 by @fisker)
<!-- prettier-ignore -->
```gql
# Input
query {
a(x: [
# only comment
])
}
# Prettier stable
Error: Comment "only comment" was not printed. Please report this error!
# Prettier main
query {
a(
x: [
# only comment
]
)
}
```
-26
View File
@@ -1,26 +0,0 @@
#### Fix a bug around unicode in front matter (#18453 by @seiyab)
<!-- prettier-ignore -->
```html
<!-- Input -->
---
title: 😄
---
<!-- comment -->
<!-- Prettier stable -->
---
title: 😄
---
<!-- comment --
<!-- Prettier main -->
---
title: 😄
---
<!-- comment -->
```
-26
View File
@@ -1,26 +0,0 @@
#### Fix closing tag of pre-like elements being split across lines (#19046 by @kovsu)
<!-- prettier-ignore -->
```html
<!-- Input -->
<div>
<pre>
Content
</pre>
</div>
<!-- Prettier stable -->
<div>
<pre>
Content
</pre
>
</div>
<!-- Prettier main -->
<div>
<pre>
Content
</pre>
</div>
```
-16
View File
@@ -1,16 +0,0 @@
#### Keep an inline comment attached to the preceding node (#19304 by @kovsu)
<!-- prettier-ignore -->
```html
<!-- Input -->
<p><b>x</b><!-- comment --></p>
<!-- Prettier stable -->
<p>
<b>x</b
><!-- comment -->
</p>
<!-- Prettier main -->
<p><b>x</b><!-- comment --></p>
```
-27
View File
@@ -1,27 +0,0 @@
#### Remove redundant parentheses in "return statement" (#18142 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
function sequenceExpressionInside() {
return ( // Reason for a
a, b
);
}
// Prettier stable
function sequenceExpressionInside() {
return (
// Reason for a
(a, b)
);
}
// Prettier main
function sequenceExpressionInside() {
return (
// Reason for a
a, b
);
}
```
@@ -1,56 +0,0 @@
#### Fix alignment in embedded template interpolations (#18380 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
string = `
.class {
flex-direction: column${
long_cond && long_cond && long_cond
? "-reverse" :
""
};
}
`;
css = css`
.class {
flex-direction: column${
long_cond && long_cond && long_cond
? "-reverse" :
""
};
}
`;
// Prettier stable
string = `
.class {
flex-direction: column${
long_cond && long_cond && long_cond ? "-reverse" : ""
};
}
`;
css = css`
.class {
flex-direction: column${long_cond && long_cond && long_cond
? "-reverse"
: ""};
}
`;
// Prettier main
string = `
.class {
flex-direction: column${
long_cond && long_cond && long_cond ? "-reverse" : ""
};
}
`;
css = css`
.class {
flex-direction: column${
long_cond && long_cond && long_cond ? "-reverse" : ""
};
}
`;
```
-34
View File
@@ -1,34 +0,0 @@
#### Avoid linebreaks in embedded template interpolations (#18380 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
string = /* Comment */ `
<div>${long_cond && long_cond && long_cond && long_cond && long_cond ? "content" : ""}</div>
`;
html = /* HTML */ `
<div>${long_cond && long_cond && long_cond && long_cond && long_cond ? "content" : ""}</div>
`;
// Prettier stable
string = /* Comment */ `
<div>${long_cond && long_cond && long_cond && long_cond && long_cond ? "content" : ""}</div>
`;
html = /* HTML */ `
<div>
${long_cond && long_cond && long_cond && long_cond && long_cond
? "content"
: ""}
</div>
`;
// Prettier main
string = /* Comment */ `
<div>${long_cond && long_cond && long_cond && long_cond && long_cond ? "content" : ""}</div>
`;
html = /* HTML */ `
<div>
${long_cond && long_cond && long_cond && long_cond && long_cond ? "content" : ""}
</div>
`;
```
-58
View File
@@ -1,58 +0,0 @@
#### Improve logical not expression print (#18397, #18401 by @fisker)
- Fixed inner logical expression can be double parenthesized in some case.
- Inline the expression in `if`/`while`/`do..while` condition, to reduce diff when changing condition to negated value.
<!-- prettier-ignore -->
```jsx
// Input
if (!(
// `import("foo")`
node.type === "ImportExpression" ||
// `type foo = import("foo")`
node.type === "TSImportType"
)) {
} else if (
// `import("foo")`
node.type === "ImportExpression" ||
// `type foo = import("foo")`
node.type === "TSImportType"
) {
}
// Prettier stable
if (
!(
// `import("foo")`
(
node.type === "ImportExpression" ||
// `type foo = import("foo")`
node.type === "TSImportType"
)
)
) {
} else if (
// `import("foo")`
node.type === "ImportExpression" ||
// `type foo = import("foo")`
node.type === "TSImportType"
) {
}
// Prettier main
if (!(
// `import("foo")`
node.type === "ImportExpression" ||
// `type foo = import("foo")`
node.type === "TSImportType"
)) {
} else if (
// `import("foo")`
node.type === "ImportExpression" ||
// `type foo = import("foo")`
node.type === "TSImportType"
) {
}
```
_This code example above is [a real world case](https://github.com/prettier/prettier/blob/edb53db4b1ec326d3f0f4fb683f56c83beefeba4/src/language-js/print/call-expression.js#L135-L155) right here in the Prettier codebase_
-20
View File
@@ -1,20 +0,0 @@
#### Remove unexpected space inserted before expression in CSS selectors (#18460 by @kovsu)
<!-- prettier-ignore -->
```js
// Input
css`foo:${bar} {}`
// Prettier stable
css`
foo: ${bar} {
}
`;
// Prettier main
css`
foo:${bar} {
}
`;
```
-35
View File
@@ -1,35 +0,0 @@
#### Keep iife function comments in parentheses (#18538 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const a = (
/**
* @param {number} foo
* @return {number}
*/
function (foo) {
return foo + 1;
}
)(1);
// Prettier stable
const a = /**
* @param {number} foo
* @return {number}
*/
(function (foo) {
return foo + 1;
})(1);
// Prettier main
const a = (
/**
* @param {number} foo
* @return {number}
*/
function (foo) {
return foo + 1;
}
)(1);
```
-25
View File
@@ -1,25 +0,0 @@
#### Fix comment print for parenthesized callee (#18540 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const a = (
function(){}
/* comment for callee */
)(),
b = (
function(){}
)(/* comment for call */)
// Prettier stable
const a = (function () {})(),
/* comment for callee */
b = (function () {})(/* comment for call */);
// Prettier main
const a = (
function () {}
/* comment for callee */
)(),
b = (function () {})(/* comment for call */);
```
-14
View File
@@ -1,14 +0,0 @@
#### Preserve trailing double spaces in JSDoc (#18594 by @seiyab)
Some tools treat these spaces as meaningful.
```js
await prettier.format("/**\n * With 2 spaces \n */", { parser: "babel" });
/* Prettier stable */
// -> '/**\n * With 2 spaces\n */\n'
/* Prettier main */
// -> '/**\n * With 2 spaces \n */\n'
// ^^ space preserved
```
-23
View File
@@ -1,23 +0,0 @@
#### Drop support for the old "import assertions" syntax (#18611 by @fisker)
`import assertions` (using the `assert` keyword) is an old version of the current [import attributes proposal](https://github.com/tc39/proposal-import-attributes).
```js
// Old (deprecated)
import foo from "./foo.json" assert { type: "json" };
// Current standard
import foo from "./foo.json" with { type: "json" };
```
Babel 8 completely removed support for the legacy `assert` syntax (the old parser plugin is gone).
Without Babel parser support, Prettier can no longer reliably parse or format code using `import ... assert { ... }`.
Please migrate to the `with` syntax.
```diff
- import foo from "./foo.json" assert { type: "json" };
+ import foo from "./foo.json" with { type: "json" };
```
See also Prettier's [disclaimer about non-standard syntax](https://prettier.io/docs/rationale.html#disclaimer-about-non-standard-syntax).
@@ -1,53 +0,0 @@
#### Improve comment handling around empty call argument list (#18615 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
call
// line comment
();
call(// line comment
);
call(
// line comment
);
call
/* block comment */
();
call(/* block comment */
);
call(
/* block comment */
);
// Prettier stable
call();
// line comment
call(); // line comment
call();
// line comment
call();
/* block comment */
call /* block comment */();
call();
/* block comment */
// Prettier main
call
// line comment
();
call(
// line comment
);
call(
// line comment
);
call
/* block comment */
();
call(/* block comment */);
call(/* block comment */);
```
@@ -1,21 +0,0 @@
#### Fix unstable comment in call expression (#18615 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
foo =
call(
/* call argument */);
// Prettier stable (First format)
foo =
call();
/* call argument */
// Prettier stable (Second format)
foo = call();
/* call argument */
// Prettier main
foo = call(/* call argument */);
```
-29
View File
@@ -1,29 +0,0 @@
#### Allow empty call expression argument list with long comments to break (#18615 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
call(/* a long long long long long long long long long long long long comment */);
array = [/* a long long long long long long long long long long long long comment */];
object = {/* a long long long long long long long long long long long long comment */};
// Prettier stable
call(/* a long long long long long long long long long long long long comment */);
array = [
/* a long long long long long long long long long long long long comment */
];
object = {
/* a long long long long long long long long long long long long comment */
};
// Prettier main
call(
/* a long long long long long long long long long long long long comment */
);
array = [
/* a long long long long long long long long long long long long comment */
];
object = {
/* a long long long long long long long long long long long long comment */
};
```
-20
View File
@@ -1,20 +0,0 @@
#### Don't force empty array and object with short comments to break (#18617 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const array = [/* comment */]
const object = {/* comment */}
// Prettier stable
const array = [
/* comment */
];
const object = {
/* comment */
};
// Prettier main
const array = [/* comment */];
const object = {/* comment */};
```
-27
View File
@@ -1,27 +0,0 @@
#### Fix dangling comment print in function parameters (#18623 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
fn = function(
// comment
) {}
arrow = (
// comment
) => {}
// Prettier stable
fn = function () // comment
{};
arrow = () =>
// comment
{};
// Prettier main
fn = function (
// comment
) {};
arrow = (
// comment
) => {};
```
-29
View File
@@ -1,29 +0,0 @@
#### Fix inconsistent comment attach between `NewExpression` and `CallExpression` (#18669 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
foo( // comment
bar
);
new Foo( // comment
bar
);
// Prettier stable
foo(
// comment
bar,
);
new Foo(bar); // comment
// Prettier main
foo(
// comment
bar,
);
new Foo(
// comment
bar,
);
```
-13
View File
@@ -1,13 +0,0 @@
#### Fix missing parentheses around optional chaining (#18720 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
(a?.b()).c();
// Prettier stable
a?.b().c();
// Prettier main
(a?.b()).c();
```
-14
View File
@@ -1,14 +0,0 @@
#### Fix range format on variable declaration (#18734, #18740 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
let i ="format me!" ;
// ^^^^^^^^^^^^^^ Range
// Prettier stable
let i = "format me!"; ;
// Prettier main
let i = "format me!";
```
@@ -1,28 +0,0 @@
#### Improve blank line detection between statements (#18736 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const exports = text
.matchAll(/(?<=\n)exports\.(?<specifier>\w+) = \k<specifier>;/g)
.map((match) => match.groups.specifier)
.toArray()
;
foo();
// Prettier stable (--no-semi)
const exports = text
.matchAll(/(?<=\n)exports\.(?<specifier>\w+) = \k<specifier>;/g)
.map((match) => match.groups.specifier)
.toArray();
foo();
// Prettier main
const exports = text
.matchAll(/(?<=\n)exports\.(?<specifier>\w+) = \k<specifier>;/g)
.map((match) => match.groups.specifier)
.toArray();
foo();
```
-18
View File
@@ -1,18 +0,0 @@
#### Preserve empty line before `;` in `no-semi` mode (#18736, #18737 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
a
;[].b()
// Prettier stable (--no-semi)
a
;[].b()
// Prettier main
a
;[].b()
```
-16
View File
@@ -1,16 +0,0 @@
#### Print leading semicolon before type cast comments (#18751 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
;/** @type {string[]} */ (['foo', 'bar']).forEach(doStuff)
// Prettier stable (--no-semi, first format)
/** @type {string[]} */ ;(["foo", "bar"]).forEach(doStuff)
// Prettier stable (--no-semi, second format)
/** @type {string[]} */ ;["foo", "bar"].forEach(doStuff)
// Prettier main (--no-semi)
;/** @type {string[]} */ (["foo", "bar"]).forEach(doStuff)
```
-30
View File
@@ -1,30 +0,0 @@
#### Prevent moving comments after arrow into parameters (#18775 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
KEYPAD_NUMBERS.map(num => ( // Buttons 0-9
<div />
));
const createIdFilter =
(foo) => /** @param {string} id */
(id) => id;
// Prettier stable
KEYPAD_NUMBERS.map(
(
num // Buttons 0-9
) => <div />
);
const createIdFilter = (foo /** @param {string} id */) => (id) => id;
// Prettier main
KEYPAD_NUMBERS.map((num) => (
// Buttons 0-9
<div />
));
const createIdFilter = (foo) => /** @param {string} id */ (id) => id;
```
-30
View File
@@ -1,30 +0,0 @@
#### Fix comments above `else` (#18813 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
/* Case 1 */
if (1) {
}
/* Case 2 */
else if (2) {
}
// Prettier stable
/* Case 1 */
if (1) {
} else if (2) {
/* Case 2 */
}
// Prettier main
/* Case 1 */
if (1) {
}
/* Case 2 */
else if (2) {
}
```
-14
View File
@@ -1,14 +0,0 @@
#### Fix "comment not printed" error in debugger statement (#18840 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
debugger // Comment
;
// Prettier stable
Error: Comment "comment" was not printed. Please report this error!
// Prettier main
debugger; // Comment
```
-30
View File
@@ -1,30 +0,0 @@
#### Improve `do..while` print in `no-semi` mode (#18851 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
do {
doStuff()
} while (1)
// comment
;[foo, bar].forEach(doStuff)
// Prettier stable
do {
doStuff()
} while (
1
// comment
)
;[foo, bar].forEach(doStuff)
// Prettier main
do {
doStuff()
} while (1)
// comment
;[foo, bar].forEach(doStuff)
```
-26
View File
@@ -1,26 +0,0 @@
#### Fix duplicated comments in empty branches with `experimentalTernaries` (#18963 by @kovsu)
<!-- prettier-ignore -->
```jsx
// Input
condition ? ifTrue
: [
// Hello, world!
];
// Prettier stable (--experimental-ternaries)
condition ? ifTrue
// Hello, world!
: (
[
// Hello, world!
]
);
// Prettier main (--experimental-ternaries)
condition ? ifTrue : (
[
// Hello, world!
]
);
```
-37
View File
@@ -1,37 +0,0 @@
#### Preserve blank lines between JSX attributes (#19161 by @Poliklot)
Prettier now keeps one existing blank line between JSX attributes, consistent with how it preserves blank lines in many other places. Multiple blank lines are still collapsed to one.
<!-- prettier-ignore -->
```jsx
// Input
<Button
type="submit"
variant="primary"
size="large"
disabled={isSubmitting}
onClick={handleSubmit}
/>;
// Prettier stable
<Button
type="submit"
variant="primary"
size="large"
disabled={isSubmitting}
onClick={handleSubmit}
/>;
// Prettier main
<Button
type="submit"
variant="primary"
size="large"
disabled={isSubmitting}
onClick={handleSubmit}
/>;
```
-20
View File
@@ -1,20 +0,0 @@
#### Fix multiline JSDoc-style comment alignment in assignments (#19180 by @kovsu)
<!-- prettier-ignore -->
```jsx
// Input
const foo = /**
* comment
*/ bar;
// Prettier stable
const foo = /**
* comment
*/ bar;
// Prettier main
const foo =
/**
* comment
*/ bar;
```
-16
View File
@@ -1,16 +0,0 @@
#### Remove space in `for` statement without "update" expression (#19188 by @Poliklot)
<!-- prettier-ignore -->
```jsx
// Input
for (initialize;;) {}
for (; condition;) {}
// Prettier stable
for (initialize; ; ) {}
for (; condition; ) {}
// Prettier main
for (initialize; ;) {}
for (; condition;) {}
```
-13
View File
@@ -1,13 +0,0 @@
#### Fix unstable comment in arrow function with sequence expression body (#19253 by @itsybitsybootsy)
<!-- prettier-ignore -->
```jsx
// Input
const fn = () => (a, b, c /* abc */);
// Prettier stable
const fn = () => (a, b, c) /* abc */;
// Prettier main
const fn = () => (a, b, c /* abc */);
```
-13
View File
@@ -1,13 +0,0 @@
#### Fix unstable comment in arrow function with assignment expression body (#19262 by @itsybitsybootsy)
<!-- prettier-ignore -->
```jsx
// Input
const fn = () => (a = b /* abc */);
// Prettier stable
const fn = () => (a = b) /* abc */;
// Prettier main
const fn = () => (a = b /* abc */);
```
-16
View File
@@ -1,16 +0,0 @@
#### Keep trailing comments inside the parentheses of a sequence or assignment expression (#19263 by @sarathfrancis90)
<!-- prettier-ignore -->
```jsx
// Input
const x = (a, b, c /* comment */);
const y = (a = b /* comment */);
// Prettier stable
const x = (a, b, c) /* comment */;
const y = (a = b) /* comment */;
// Prettier main
const x = (a, b, c /* comment */);
const y = (a = b /* comment */);
```
-20
View File
@@ -1,20 +0,0 @@
#### Improve formatting of comments in objects (#19310 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const P = {/** X */
Y: "z",
}
// Prettier stable
const P = {
/** X */ Y: "z",
};
// Prettier main
const P = {
/** X */
Y: "z",
};
```
-39
View File
@@ -1,39 +0,0 @@
#### Stabilize comment around `break` and `continue` in no-semi mode (#7161 by @thorn0, @fisker)
<!-- prettier-ignore -->
```jsx
// Input
for (;;) {
if (condition) {
break; // breaking comment
(possibleArray || []).sort()
}
}
// Prettier stable (--no-semi, first format)
for (;;) {
if (condition) {
break // breaking comment
;(possibleArray || []).sort()
}
}
// Prettier stable (--no-semi, second format)
for (;;) {
if (condition) {
break // breaking comment
;(possibleArray || []).sort()
}
}
// Prettier main (--no-semi, both first and second format)
for (;;) {
if (condition) {
break; // breaking comment
(possibleArray || []).sort();
}
}
```
-48
View File
@@ -1,48 +0,0 @@
#### Preserve number and string representation in `json-stringify` parser (#18405 by @fisker)
Previous versions of Prettier `json-stringify` parser used `JSON.stringify()` to print numbers and strings. This led to the loss of the original value representation in a few rare cases. For example, extremely large or small numbers were rounded, and some special characters were unescaped. Technically, these transformations do not change how JSON values are read, but they are not something a formatter [is concerned about](https://prettier.io/docs/rationale#strings). Prettier main now keeps the original representation, even if it can be simplified.
<!-- prettier-ignore -->
```jsonc
// Input
[
"\u00FF",
1e9999,
0.4e669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006,
-9223372036854775809,
1e3,
{
1e3: 1,
1e999999999999999999999999999999: 1,
1: 1
}
]
// Prettier stable
[
"ÿ",
null,
null,
-9223372036854776000,
1000,
{
"1000": 1,
"Infinity": 1,
"1": 1
}
]
// Prettier main
[
"\u00FF",
1e9999,
0.4e669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006,
-9223372036854775809,
1e3,
{
1e3: 1,
1e999999999999999999999999999999: 1,
"1": 1
}
]
```
-18
View File
@@ -1,18 +0,0 @@
#### Fix Markdown emphasis near non-breaking space (#17424 by @rkdfx)
Underscore-style emphasis adjacent to a Unicode whitespace (e.g. non-breaking space) was being rewritten to asterisks, because the surrounding text was treated as a regular word.
<!-- prettier-ignore -->
```md
<!-- Input -->
- _REPORTED_ — message received;
- _NEEDSINFO_ — additional info needed;
<!-- Prettier stable -->
- *REPORTED* — message received;
- *NEEDSINFO* — additional info needed;
<!-- Prettier main -->
- _REPORTED_ — message received;
- _NEEDSINFO_ — additional info needed;
```
-7
View File
@@ -1,7 +0,0 @@
#### [HIGHLIGHT] Upgrade parser to latest micromark (#18277 by @seiyab, @j-f1, @fisker)
We've upgraded Prettier's Markdown parser from the outdated `remark-parse` v8 to the modern `micromark` v4. This upgrade significantly enhances CommonMark and GFM compliance, resolves numerous long-standing parsing bugs, and lays a stronger foundation for future enhancements.
Huge thanks to [@seiyab](https://github.com/seiyab), [@j-f1](https://github.com/j-f1), and everyone else who contributed to this long-awaited improvement for their tremendous effort in driving this major upgrade!
**Note**: While the core Markdown parser has been upgraded, [the MDX parser upgrade](https://github.com/prettier/prettier/pull/18533) is not yet complete. If you're familiar with the unified ecosystem, micromark, or MDX, we'd love your help to finish the migration — contributions are very welcome!
-39
View File
@@ -1,39 +0,0 @@
#### Support setext headings (#18473 by @fisker)
<!-- prettier-ignore -->
```md
<!-- Input -->
Setext Heading 1
================
Setext Heading 2
----------------
Multiline
Setext
Heading
-------
<!-- Prettier stable -->
# Setext Heading 1
## Setext Heading 2
Multiline
Setext
Heading
---
<!-- Prettier main -->
Setext Heading 1
================
Setext Heading 2
----------------
Multiline
Setext
Heading
-------
```
-17
View File
@@ -1,17 +0,0 @@
#### Treat U+3000 as CJK punctuation-equivalent and make sure to recognize U+FF5E as CJK punctuation again in Markdown prose wrap (#18656 by @tats-u)
We improved the text wrapping in Markdown written in Chinese and Japanese by treating some non Unicode punctuation characters as equivalent to CJK punctuation. A part of this was assumed to have been introduced in 3.5.0 ([#16832](https://github.com/prettier/prettier/pull/16832)), but it was not fully implemented and not noticed until now due to insufficient test cases.
```js
await prettier.format(
"U+3000\u{3000}\nU+301C\u{301C}\nU+FF5E\u{FF5E}\nU+1F221\u{1F221} 测试 Test テスト\n",
{ parser: "markdown", proseWrap: "always" },
);
/* Prettier stable */
// -> 'U+3000  U+301C〜U+FF5E~ U+1F221🈡 测试 Test テスト\n'
//  ^ extra space  ^ extra space
/* Prettier main */
// -> 'U+3000 U+301C〜U+FF5E~U+1F221🈡 测试 Test テスト\n'
```
-20
View File
@@ -1,20 +0,0 @@
#### Fix CJK line break loss near list-like numbers (#18867 by @it-education-md)
Avoid collapsing line breaks before list-like numbers followed by CJK characters (e.g. 3.中).
<!-- prettier-ignore -->
```markdown
<!-- Input -->
1.a
2.b
3.中
<!-- Prettier stable -->
1.a
2.b 3.中
<!-- Prettier main -->
1.a
2.b
3.中
```
-22
View File
@@ -1,22 +0,0 @@
#### Fix extra blank line between a list and an indented code block (#19154 by @YBJ0000)
Prettier forced two blank lines whenever an indented code block followed a list. The extra blank line is never semantically required and contradicts Prettier's usual behavior of collapsing consecutive blank lines into a single one.
<!-- prettier-ignore -->
```markdown
<!-- Input -->
- one
two
<!-- Prettier stable -->
- one
two
<!-- Prettier main -->
- one
two
```
-18
View File
@@ -1,18 +0,0 @@
#### Support formatting LWC (Lightning Web Components) syntax in code block (#19291 by @fisker)
<!-- prettier-ignore -->
````md
<!-- Input -->
```lwc
<test-this attr={test}>
Awesome </test-this>
```
<!-- Prettier stable -->
Same as input
<!-- Prettier main -->
```lwc
<test-this attr={test}> Awesome </test-this>
```
````
-31
View File
@@ -1,31 +0,0 @@
#### Escape unindented indented pseudo setext headers (#19350 by @tats-u)
Indented lines composed of only `=` or `-` were previously unindented without being escaped, which caused them to be mistakenly parsed as setext headers. With this change, Prettier now escapes such lines to prevent the misinterpretation:
[Check parse results on CommonMark playground](https://spec.commonmark.org/dingus/?text=%3C!--%20Input%20--%3E%0ANot%20a%20header%0A%20%20%20%20%3D%3D%3D%0ANot%20a%20header%0A%20%20%20%20---%0ANot%20a%20list%20item%20or%20a%20header%0A%20%20%20%20-%0A%0A------%0A%0A%3C!--%20Prettier%20stable%20--%3E%0ANot%20a%20header%0A%3D%3D%3D%0ANot%20a%20header%0A---%0ANot%20a%20list%20item%20or%20a%20header%20-%0A%0A------%0A%0A%3C!--%20Prettier%20main%20--%3E%0ANot%20a%20header%0A%5C%3D%3D%3D%0ANot%20a%20header%0A%5C---%0ANot%20a%20list%20item%20or%20a%20header%0A%5C-)
<!-- prettier-ignore -->
```markdown
<!-- Input -->
Not a header
===
Not a header
---
Not a list item or a header
-
<!-- Prettier stable -->
Not a header
===
Not a header
---
Not a list item or a header -
<!-- Prettier main -->
Not a header
\===
Not a header
\---
Not a list item or a header
\-
```
-13
View File
@@ -1,13 +0,0 @@
#### Update `Printer` interface (#19014 by @Janther)
```diff
export interface Printer<T = any> {
// ...
- print: (AstPath<T>) => Doc,
+ print: (
+ selector?: string | number | Array<string | number> | AstPath<T>,
+ args?: unknown,
+ ) => Doc,
// ...
}
```
-18
View File
@@ -1,18 +0,0 @@
#### Prevent adding trailing comma in math expression within function arguments (#18530 by @kovsu)
<!-- prettier-ignore -->
```scss
// Input
@include container($foo: 2 * ($bar + $baz));
// Prettier stable
@include container(
$foo: 2 *
(
$bar + $baz,
)
);
// Prettier main
@include container($foo: 2 * ($bar + $baz));
```
-17
View File
@@ -1,17 +0,0 @@
#### Fix comment print in maps (#18535 by @kovsu)
<!-- prettier-ignore -->
```scss
// Input
$map: (
// comment
);
// Prettier stable
$map: (// comment);
// Prettier main
$map: (
// comment
);
```
-22
View File
@@ -1,22 +0,0 @@
#### Avoid adding trailing comma to parenthesized scalars (#19091 by @cyphercodes)
<!-- prettier-ignore -->
```scss
// Input
.a { background-color: rgba($color: (#808080), $alpha: 0.9); }
// Prettier stable
.a {
background-color: rgba(
$color: (
#808080,
),
$alpha: 0.9
);
}
// Prettier main
.a {
background-color: rgba($color: (#808080), $alpha: 0.9);
}
```
-13
View File
@@ -1,13 +0,0 @@
#### Remove space before `;` delimiter in SCSS `if()` function (#19384 by @kovsu)
<!-- prettier-ignore -->
```scss
// Input
$value: if(sass($x): 1 ; else: 2);
// Prettier stable
$value: if(sass($x): 1 ; else: 2);
// Prettier main
$value: if(sass($x): 1; else: 2);
```
-31
View File
@@ -1,31 +0,0 @@
#### Fix linebreak in member chain (#17251 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
model = types
.model({ something: mxSomething })
.volatile<| "a" | "b">(() => [
annularThingamabobWrapper,
octahedralWeevilService,
cantileveredRhubarbProcessor,
annularPlatypusGenerator,
]);
// Prettier stable
model = types
.model({ something: mxSomething })
.volatile<
"a" | "b"
>(() => [annularThingamabobWrapper, octahedralWeevilService, cantileveredRhubarbProcessor, annularPlatypusGenerator]);
// Prettier main
model = types
.model({ something: mxSomething })
.volatile<"a" | "b">(() => [
annularThingamabobWrapper,
octahedralWeevilService,
cantileveredRhubarbProcessor,
annularPlatypusGenerator,
]);
```
-45
View File
@@ -1,45 +0,0 @@
#### Fix formatting for new expression with type cast (#18507 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
new (require("./webpack/plugins/next-trace-entrypoints-plugin")
.TraceEntryPointsPlugin as P)({
rootDir: dir,
});
(
require("./webpack/plugins/next-trace-entrypoints-plugin")
.TraceEntryPointsPlugin as P
)({
rootDir: dir,
});
// Prettier stable
new (require("./webpack/plugins/next-trace-entrypoints-plugin")
.TraceEntryPointsPlugin as P)({
rootDir: dir,
});
(
require("./webpack/plugins/next-trace-entrypoints-plugin")
.TraceEntryPointsPlugin as P
)({
rootDir: dir,
});
// Prettier main
new (
require("./webpack/plugins/next-trace-entrypoints-plugin")
.TraceEntryPointsPlugin as P
)({
rootDir: dir,
});
(
require("./webpack/plugins/next-trace-entrypoints-plugin")
.TraceEntryPointsPlugin as P
)({
rootDir: dir,
});
```
-35
View File
@@ -1,35 +0,0 @@
#### Fix line comments jumping past member expression lookups (#18522 by @ulrichstark)
Line comments between a member expression object and property were incorrectly moved past subsequent content like `as` expressions.
<!-- prettier-ignore -->
```tsx
// Input
function getClassNameFromPrototypeMethod(container) {
return ((container // a
.left as PropertyAccessExpression) // b
.expression as PropertyAccessExpression) // c
.expression; // d
}
// Prettier stable
function getClassNameFromPrototypeMethod(container) {
return (
(
container.left as PropertyAccessExpression // a
).expression as PropertyAccessExpression // b
).expression; // c // d
}
// Prettier main
function getClassNameFromPrototypeMethod(container) {
return (
(
container // a
.left as PropertyAccessExpression
) // b
.expression as PropertyAccessExpression
) // c
.expression; // d
}
```
-39
View File
@@ -1,39 +0,0 @@
#### Fix inconsistent formatting of arrow function (#18589 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
a.map(() => ({
name,
}));
a.map(():A => ({
name,
}));
a.map(():{A} => ({
name,
}));
// Prettier stable
a.map(() => ({
name,
}));
a.map(
(): A => ({
name,
}),
);
a.map((): { A } => ({
name,
}));
// Prettier main
a.map(() => ({
name,
}));
a.map((): A => ({
name,
}));
a.map((): { A } => ({
name,
}));
```
-37
View File
@@ -1,37 +0,0 @@
#### Improve comment print inside type arguments (#18619 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
foo<
// Comment
Type
>(
// Comment
value
)
foo<
Type // Comment
>(
)
// Prettier stable
foo<// Comment
Type>(
// Comment
value,
);
foo<Type>(); // Comment
// Prettier main
foo<
// Comment
Type
>(
// Comment
value,
);
foo<
Type // Comment
>();
```
-25
View File
@@ -1,25 +0,0 @@
#### Fix conditional type comment indentation (#18644 by @lindsaycode05)
<!-- prettier-ignore -->
```tsx
// Input
type T = any extends B
// Comment
// Multiline comment
? undefined | NonNullable<B>[foo]
: B[foo];
// Prettier stable
type T = any extends B
? // Comment
// Multiline comment
undefined | NonNullable<B>[foo]
: B[foo];
// Prettier main
type T = any extends B
? // Comment
// Multiline comment
undefined | NonNullable<B>[foo]
: B[foo];
```
-22
View File
@@ -1,22 +0,0 @@
#### Fix inconsistent formatting of class superClass (#18652, #18659 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
class ALongLongLongLongLongLongLongLongLongLongLongLongClassName
extends foo.bar.Baz {}
class ALongLongLongLongLongLongLongLongLongLongLongLongClassName
extends foo.bar.Baz! {}
// Prettier stable
class ALongLongLongLongLongLongLongLongLongLongLongLongClassName
extends foo.bar.Baz {}
class ALongLongLongLongLongLongLongLongLongLongLongLongClassName extends (foo
.bar.Baz!) {}
// Prettier main
class ALongLongLongLongLongLongLongLongLongLongLongLongClassName
extends foo.bar.Baz {}
class ALongLongLongLongLongLongLongLongLongLongLongLongClassName
extends foo.bar.Baz! {}
```
-53
View File
@@ -1,53 +0,0 @@
#### Consistent print non-null assertions (#18654 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
const corners = baseCorners.map((corner) =>
curveCatmullRomCubicApproxPoints(curveOffsetPoints(corner, offset))!,
);
const corners = baseCorners.map((corner) =>
curveCatmullRomCubicApproxPoints(curveOffsetPoints(corner, offset)),
);
// Prettier stable
const corners = baseCorners.map(
(corner) =>
curveCatmullRomCubicApproxPoints(curveOffsetPoints(corner, offset))!,
);
const corners = baseCorners.map((corner) =>
curveCatmullRomCubicApproxPoints(curveOffsetPoints(corner, offset)),
);
// Prettier main
const corners = baseCorners.map((corner) =>
curveCatmullRomCubicApproxPoints(curveOffsetPoints(corner, offset))!,
);
const corners = baseCorners.map((corner) =>
curveCatmullRomCubicApproxPoints(curveOffsetPoints(corner, offset)),
);
```
<!-- prettier-ignore -->
```tsx
// Input
isEqual(a?.map(([t, _]) => t?.id)!, b?.map(([t, _]) => t?.id));
isEqual(a?.map(([t, _]) => t?.id)!, b?.map(([t, _]) => t?.id)!);
// Prettier stable
isEqual(
a?.map(([t, _]) => t?.id)!,
b?.map(([t, _]) => t?.id),
);
isEqual(a?.map(([t, _]) => t?.id)!, b?.map(([t, _]) => t?.id)!);
// Prettier main
isEqual(
a?.map(([t, _]) => t?.id)!,
b?.map(([t, _]) => t?.id),
);
isEqual(
a?.map(([t, _]) => t?.id)!,
b?.map(([t, _]) => t?.id)!,
);
```
-19
View File
@@ -1,19 +0,0 @@
#### Preserve non-null assertion around optional chaining (#18661 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
(a?.b!).c;
(a?.b)!.c;
(a?.b!)!.c;
// Prettier stable
(a?.b)!.c;
(a?.b)!.c;
a?.b!!.c;
// Prettier main
(a?.b!).c;
(a?.b)!.c;
(a?.b!)!.c;
```
-32
View File
@@ -1,32 +0,0 @@
#### Respect `quoteProps` option when printing enum keys (#18700, #18703 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
enum E {
A1 = 0,
"A2" = 1,
"A-3" = 2,
}
// Prettier stable
enum E {
A1 = 0,
"A2" = 1,
"A-3" = 2,
}
// Prettier main (--quote-props=as-needed)
enum E {
A1 = 0,
A2 = 1,
"A-3" = 2,
}
// Prettier main (--quote-props=consistent)
enum E {
"A1" = 0,
"A2" = 1,
"A-3" = 2,
}
```
-32
View File
@@ -1,32 +0,0 @@
#### Respect `quoteProps` in method signature (#18702 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
type T = {
method1(): string;
"method2"(): string;
"method-3"(): string;
};
// Prettier stable
type T = {
method1(): string;
"method2"(): string;
"method-3"(): string;
};
// Prettier main (--quote-props=as-needed)
type T = {
method1(): string;
method2(): string;
"method-3"(): string;
};
// Prettier main (--quote-props=consistent)
type T = {
"method1"(): string;
"method2"(): string;
"method-3"(): string;
};
```
-20
View File
@@ -1,20 +0,0 @@
#### Keep comments in mapped type inline (#18731 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
type B = {
/* comment */ [b in B]: string
};
// Prettier stable
type B = {
/* comment */
[b in B]: string;
};
// Prettier main
type B = {
/* comment */ [b in B]: string;
};
```
-19
View File
@@ -1,19 +0,0 @@
#### Print semicolon before type assertion in `no-semi` mode (#18738 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
a;
<b>c;
// Prettier stable (--no-semi, first format)
a
<b>c
// Prettier stable (--no-semi, second format)
a < b > c
// Prettier main (--no-semi)
a
;<b>c
```
-13
View File
@@ -1,13 +0,0 @@
#### Add parentheses to conditional types in type parameter constraint (#18760 by @kovsu)
<!-- prettier-ignore -->
```ts
// Input
const foo = <Foo extends (Bar extends Baz ? A : B)>() => true;
// Prettier stable
const foo = <Foo extends Bar extends Baz ? A : B>() => true;
// Prettier main
const foo = <Foo extends (Bar extends Baz ? A : B)>() => true;
```
-40
View File
@@ -1,40 +0,0 @@
#### Fix printing comment for the last operand of union types (#18798 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
type Foo2 = (
| "thing1" // Comment1
| "thing2" // Comment2
) & Bar; // Final comment2
type Foo2 = (
| "thing1" // Comment1
| "thing2" // Comment2
) | Bar; // Final comment2
// Prettier stable
type Foo2 = (
| "thing1" // Comment1
| "thing2" // Comment2
) &
Bar; // Final comment2
type Foo2 =
| (
| "thing1" // Comment1
| "thing2"
) // Comment2
| Bar; // Final comment2
// Prettier main
type Foo2 = (
| "thing1" // Comment1
| "thing2" // Comment2
) &
Bar; // Final comment2
type Foo2 =
| (
| "thing1" // Comment1
| "thing2" // Comment2
)
| Bar; // Final comment2
```
@@ -1,19 +0,0 @@
#### Don't break union type when it can fit (#18827 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
type Browser = "chromium" | "webkit" | "firefox" | "chromium-msedge" | "chromium-chrome";
// Prettier stable
type Browser =
| "chromium"
| "webkit"
| "firefox"
| "chromium-msedge"
| "chromium-chrome";
// Prettier main
type Browser =
"chromium" | "webkit" | "firefox" | "chromium-msedge" | "chromium-chrome";
```
-22
View File
@@ -1,22 +0,0 @@
#### Remove extra indention for union type in conditional type (#18827 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
type A = T extends "arrow"
? ExcalidrawArrowElement["startBinding"] | ExcalidrawElbowArrowElement["startBinding"]
: never;
// Prettier stable
type A = T extends "arrow"
?
| ExcalidrawArrowElement["startBinding"]
| ExcalidrawElbowArrowElement["startBinding"]
: never;
// Prettier main
type A = T extends "arrow"
? | ExcalidrawArrowElement["startBinding"]
| ExcalidrawElbowArrowElement["startBinding"]
: never;
```
-42
View File
@@ -1,42 +0,0 @@
#### Align JSDoc before union type elements (#18833 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
type A =
|
/**
* Comment
*/
a
| (b | c);
type A2 =
|
// comment
a
| (b | c);
// Prettier stable
type A =
| /**
* Comment
*/
a
| (b | c);
type A2 =
| // comment
a
| (b | c);
// Prettier main
type A =
| /**
* Comment
*/
a
| (b | c);
type A2 =
| // comment
a
| (b | c);
```
-22
View File
@@ -1,22 +0,0 @@
#### Prevent moving comment in class properties (#18837 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
class foo {
bar () /* bar */;
baz /* baz */ ();
}
// Prettier stable
class foo {
bar /* bar */();
baz /* baz */();
}
// Prettier main
class foo {
bar(); /* bar */
baz /* baz */();
}
```
-26
View File
@@ -1,26 +0,0 @@
#### Fix trailing comment in abstract method parameters (#19200 by @itsybitsybootsy)
<!-- prettier-ignore -->
```tsx
// Input
abstract class Foo {
abstract method(
param1: number,
// param2: number,
): void;
}
// Prettier stable
abstract class Foo {
abstract method(param1: number) // param2: number,
: void;
}
// Prettier main
abstract class Foo {
abstract method(
param1: number,
// param2: number,
): void;
}
```
-25
View File
@@ -1,25 +0,0 @@
#### Avoid unnecessary semicolon before call signatures in `no-semi` mode (#19212 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
export interface MyInterface {
someMethod: (a: number) => Promise<number>
anotherMethod: (a: string) => Promise<string>
(a: string): Promise<string>
}
// Prettier stable (--no-semi)
export interface MyInterface {
someMethod: (a: number) => Promise<number>
anotherMethod: (a: string) => Promise<string>;
(a: string): Promise<string>
}
// Prettier main
export interface MyInterface {
someMethod: (a: number) => Promise<number>
anotherMethod: (a: string) => Promise<string>
(a: string): Promise<string>
}
```
-22
View File
@@ -1,22 +0,0 @@
#### Preserve comment position after `=` in type alias declarations (#19410 by @WhoamiI00)
<!-- prettier-ignore -->
```ts
// Input
type A =
/* 1 */ | /* 2 */ (
/* 3 */ | /* 4 */ {
key: string;
}
);
// Prettier stable
type A /* 2 */ = /* 1 */ /* 3 */ /* 4 */ {
key: string;
};
// Prettier main
type A = /* 1 */ /* 2 */ /* 3 */ /* 4 */ {
key: string;
};
```
-25
View File
@@ -1,25 +0,0 @@
#### Fix missing parentheses around instantiation expression (#19442 by @fisker)
<!-- prettier-ignore -->
```tsx
// Input
async function* f() {
makeRecord = (yield* makeRecordFactory)<ManualValue>;
makeRecord = (yield makeRecordFactory)<ManualValue>;
makeRecord = (await makeRecordFactory)<ManualValue>;
}
// Prettier stable
async function* f() {
makeRecord = yield* makeRecordFactory<ManualValue>;
makeRecord = yield makeRecordFactory<ManualValue>;
makeRecord = await makeRecordFactory<ManualValue>;
}
// Prettier main
async function* f() {
makeRecord = (yield* makeRecordFactory)<ManualValue>;
makeRecord = (yield makeRecordFactory)<ManualValue>;
makeRecord = (await makeRecordFactory)<ManualValue>;
}
```
Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff. Show more