Clean changelog_unreleased

This commit is contained in:
Sosuke Suzuki committed 2024-01-13 01:22:01 +09:00
1 parent 9bb952d651
commit c52f441846
16 files changed
-332

No files matched your search

-19
View File
@@ -1,19 +0,0 @@
#### Support formatting for Angular ICU expression (#15777 by @sosukesuzuki)
Support two kinds of Angular ICU expressions: [`plural`](https://angular.dev/guide/i18n/translation-files#translate-plurals) and [`select`](https://angular.dev/guide/i18n/translation-files#translate-alternate-expressions).
<!-- prettier-ignore -->
```html
<span i18n>
Updated:
{minutes, plural,
=0 {just now}
=1 {one minute ago}
other {{{minutes}} minutes ago}
}
</span>
<span i18n>
The author is {gender, select, male {male} female {female} other {other}}
</span>
```
-30
View File
@@ -1,30 +0,0 @@
#### Fix `prettier-ignore`d angular control flow block (#15827 by @fisker)
<!-- prettier-ignore -->
```html
<!-- Input -->
<!-- prettier-ignore -->
@if (condition) {
Foo
} @else {
Other
}
<!-- Prettier stable -->
<!-- prettier-ignore -->
@if (condition) {
Foo
}
} @else {
Other
}
<!-- Prettier main -->
<!-- prettier-ignore -->
@if (condition) {
Foo
}
@else {
Other
}
```
-13
View File
@@ -1,13 +0,0 @@
#### Avoid adding colon for `track` in 3rd expression of `for` blocks (#15887 by @sosukesuzuki)
<!-- prettier-ignore -->
```html
<!-- Input -->
@for (item of items; let i = $index; track block) {}
<!-- Prettier stable -->
@for (item of items; let i = $index; track: block) {}
<!-- Prettier main -->
@for (item of items; let i = $index; track block) {}
```
-15
View File
@@ -1,15 +0,0 @@
#### Support absolute path as plugin in config file (#15666 by @fisker)
```js
// prettier.config.cjs
module.exports = {
plugins: [
// posix style
"/path/to/plugin.js",
// Windows style
"D:\\\\path\\to\\plugin.js",
// Use `require.resolve`
require.resolve("my-awesome-prettier-plugin"),
],
};
```
-11
View File
@@ -1,11 +0,0 @@
#### Fix `getFileInfo` and `getSupportInfo` type definitions (#15854 by @auvred)
```ts
const plugin: Plugin = {};
prettier.getFileInfo("./file.ext", {
plugins: [plugin],
});
prettier.getSupportInfo({ plugins: [plugin], showDeprecated: true });
```
-29
View File
@@ -1,29 +0,0 @@
#### Improve GraphQL union types formatting (#15870 by @ArchitGajjar)
<!-- prettier-ignore -->
```gql
# Input
union SearchResult = Conference| Festival | Concert | Venue | Conference| Festival | Concert | Venue
# Prettier stable
union SearchResult =
Conference
| Festival
| Concert
| Venue
| Conference
| Festival
| Concert
| Venue
# Prettier main
union SearchResult =
| Conference
| Festival
| Concert
| Venue
| Conference
| Festival
| Concert
| Venue
```
-21
View File
@@ -1,21 +0,0 @@
#### Preserve path literal segments (#15605 by @maxpowa)
Fixes scenarios where an input handlebars file containing literal segments would be reformatted to unwrap the literal segments, causing syntax errors in the resulting output.
<!-- prettier-ignore -->
```hbs
<!-- Input -->
{{input.[funky<api!response]}}
{{input.[this one has spaces]}}
{{input.[anotherone].[0]}}
<!-- Prettier stable -->
{{input.funky<api!response}}
{{input.this one has spaces}}
{{input.anotherone.0}}
<!-- Prettier main -->
{{input.[funky<api!response]}}
{{input.[this one has spaces]}}
{{input.anotherone.[0]}}
```
-18
View File
@@ -1,18 +0,0 @@
#### Fix formatting of prettier-ignored unclosed elements (#15748 by @fisker)
<!-- prettier-ignore -->
```html
<!-- Input -->
<!-- prettier-ignore -->
<h1>
Hello <span>world!
<!-- Prettier stable -->
<!-- prettier-ignore -->
<h1>
<!-- Prettier main -->
<!-- prettier-ignore -->
<h1>
Hello <span>world!
```
-21
View File
@@ -1,21 +0,0 @@
#### Avoid introducing linebreaks in template interpolations (#15209 by @bakkot)
In a template string like
<!-- prettier-ignore -->
```js
`this is a long message which contains an interpolation: ${format(data)} <- like this`;
```
avoid adding a linebreak when formatting the expression unless one is already present or it's unavoidable due to e.g. a nested function. Previously a linebreak could be introduced whenever some interpolation in the template was sufficiently "not simple":
<!-- prettier-ignore -->
```js
`this is a long message which contains an interpolation: ${format(
data,
)} <- like this`;
```
Now it will instead be left alone.
If a linebreak is already present within the `${...}`, format as normal.
-22
View File
@@ -1,22 +0,0 @@
#### Fix non-idempotent formatting of method chain with empty line (#15522 by @seiyab)
<!-- prettier-ignore -->
```js
// Input
Foo.a()
.b();
// Prettier stable (first format)
Foo.a()
.b();
// Prettier stable (second format)
Foo.a().b();
// Prettier main
Foo.a()
.b();
```
-19
View File
@@ -1,19 +0,0 @@
#### Fix formatting of ternary in function call (#15677 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
stopDirectory = await (useCache
? memoizedFindProjectRoot
: findProjectRootWithoutCache)(path.dirname(path.resolve(filePath)));
// Prettier stable
stopDirectory = await (useCache
? memoizedFindProjectRoot
: findProjectRootWithoutCache)(path.dirname(path.resolve(filePath)));
// Prettier main
stopDirectory = await (
useCache ? memoizedFindProjectRoot : findProjectRootWithoutCache
)(path.dirname(path.resolve(filePath)));
```
-51
View File
@@ -1,51 +0,0 @@
#### Fix inconsistencies for optional-chaining (#15806 by @fisker)
Only happens when using `typescript`, `meriyah` or other ESTree parsers except `babel`.
<!-- prettier-ignore -->
```js
// Input
function someFunctionName() {
return isEqual(a.map(([t, _]) => t?.id), b.map(([t, _]) => t?.id));
return isEqual(a?.map(([t, _]) => t?.id), b?.map(([t, _]) => t?.id));
}
theValue = Object.entries(someLongObjectName).filter(
([listingId]) => someListToCompareToHere.includes(listingId),
);
theValue = Object.entries(someLongObjectName).filter(
([listingId]) => someListToCompareToHere?.includes(listingId),
);
// Prettier stable
function someFunctionName() {
return isEqual(
a.map(([t, _]) => t?.id),
b.map(([t, _]) => t?.id),
);
return isEqual(a?.map(([t, _]) => t?.id), b?.map(([t, _]) => t?.id));
}
theValue = Object.entries(someLongObjectName).filter(([listingId]) =>
someListToCompareToHere.includes(listingId),
);
theValue = Object.entries(someLongObjectName).filter(
([listingId]) => someListToCompareToHere?.includes(listingId),
);
// Prettier main
function someFunctionName() {
return isEqual(
a.map(([t, _]) => t?.id),
b.map(([t, _]) => t?.id),
);
return isEqual(
a?.map(([t, _]) => t?.id),
b?.map(([t, _]) => t?.id),
);
}
theValue = Object.entries(someLongObjectName).filter(([listingId]) =>
someListToCompareToHere.includes(listingId),
);
theValue = Object.entries(someLongObjectName).filter(([listingId]) =>
someListToCompareToHere?.includes(listingId),
);
```
-27
View File
@@ -1,27 +0,0 @@
#### Fix comments in `if` (#15826 by @fisker)
<!-- prettier-ignore -->
```js
// Input
if (foo) for (i = 2; i > 0; i--) console.log(i); // comment 1
else bar();
for (;;){
if (foo) continue; // comment 2
else bar();
}
// Prettier stable
Error: Comment "comment 2" was not printed. Please report this error!
// Prettier main
if (foo)
for (i = 2; i > 0; i--) console.log(i); // comment 1
else bar();
for (;;) {
if (foo)
continue; // comment 2
else bar();
}
```
-9
View File
@@ -1,9 +0,0 @@
#### [Highlight] New `jsonc` parser added (#15831 by @fisker)
Previously, we infer the parser of `.jsonc` files to be `json`, but if we want keep the trailing comma, we'll have to use a hacky workaround config `{parser: "json5", quoteProps: "preserve", singleQuote: false}`.
The new added `jsonc` parser:
- Always quote the object keys.
- Wrap strings with double quotes.
- Of course, respect the [`trailingComma`](https://prettier.io/docs/en/options#trailing-commas) option.
-3
View File
@@ -1,3 +0,0 @@
#### Fix false claim in docs that cursorOffset is incompatible with rangeStart/rangeEnd (#15750 by @ExplodingCabbage)
The cursorOffset option has in fact been compatible with rangeStart/rangeEnd for over 5 years, thanks to work by @ds300. However, Prettier's documentation (including the CLI `--help` text) continued to claim otherwise, falsely. The documentation is now fixed.
-24
View File
@@ -1,24 +0,0 @@
#### Improve conditional type alias layout (#15811 by @seiyab)
<!-- prettier-ignore -->
```ts
// Input
type FallbackFlags<F extends Flags | undefined> =
Equals<NonNullableFlag<F>["flags"], {}> extends true
? Dict<any>
: NonNullableFlag<F>["flags"];
// Prettier stable
type FallbackFlags<F extends Flags | undefined> = Equals<
NonNullableFlag<F>["flags"],
{}
> extends true
? Dict<any>
: NonNullableFlag<F>["flags"];
// Prettier main
type FallbackFlags<F extends Flags | undefined> =
Equals<NonNullableFlag<F>["flags"], {}> extends true
? Dict<any>
: NonNullableFlag<F>["flags"];
```