Skip to content

Commit

Permalink
2.6 blog post (#12412)
Browse files Browse the repository at this point in the history
* Generate

* Generate

* Add TS4.6 changelog

* Regenerate

* Add changelog to switch to esbuild

* Add category

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Address review

* Regenerate

* Highlight TS 4.6

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Regenerate

* Update changelog_unreleased/typescript/12390.md

Co-authored-by: Jed Fox <git@jedfox.com>

* Add thanks message for sponsors

* Address review!

* Update cspell.json

* Fix link of Ubie

* Generate

* Add `Thanks to our sponsors!`

* Update cspell

* Address review

* Update changelog_unreleased/blog-post-intro.md

Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>

* Regenerate

* Add `--print-truncate` option

* Address review

* Generate

Co-authored-by: Jed Fox <git@jedfox.com>
Co-authored-by: Alexander Kachkaev <alexander@kachkaev.ru>
  • Loading branch information
3 people committed Mar 16, 2022
1 parent 2f45d9b commit eb671dd
Show file tree
Hide file tree
Showing 19 changed files with 894 additions and 21 deletions.
31 changes: 31 additions & 0 deletions changelog_unreleased/blog-post-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
author: "Sosuke Suzuki (@sosukesuzuki)"
authorURL: "https://github.com/sosukesuzuki"
title: "Prettier 2.6: new singleAttributePerLine option and new JavaScript features!"
---

This release includes a new `singleAttributePerLine` option. This is an option to print only one attribute per line in Vue SFC templates, HTML, and JSX. Per our [Option Philosophy](https://prettier.io/docs/en/option-philosophy.html), we would prefer not to add such an option. However, there are many users who want this feature, and major style guides like [Airbnb’s JavaScript Style Guide](https://github.com/airbnb/javascript/blob/274c8d570155a05b016980294d4204c5711bce86/packages/eslint-config-airbnb/rules/react.js#L97-L99) and [Vue’s style guide](https://vuejs.org/style-guide/rules-strongly-recommended.html#multi-attribute-elements) recommend the single attribute per line style. A [PR](https://github.com/prettier/prettier/pull/6644) to add this feature was opened in October 2019, and both it and the [corresponding issue](https://github.com/prettier/prettier/issues/5501) have received a significant amount of support from users. For us it was a hard decision to add this option. We hope the addition of this option will benefit many users without significantly harming our principles.

We've also added support formatting for some new JavaScript syntax proposals via Babel.

<!--truncate-->

## Thanks to our sponsors!

As discussed in [a blog post from earlier this year](https://prettier.io/blog/2022/01/06/prettier-begins-paying-maintainers.html), we have begun paying our maintainers from funds received from our sponsors. We would like to thank our many sponsors who have made this possible! We’re especially grateful to the following companies and individuals, who have donated over $1,000 to us:

- [Frontend Masters](https://frontendmasters.com/)
- [Salesforce](https://www.salesforce.com/)
- [Indeed](https://indeed.com/)
- [Sentry](https://sentry.io/welcome/)
- [Airbnb](https://www.airbnb.com/)
- [LINE](https://engineering.linecorp.com/en/)
- [AMP Project](https://www.ampproject.org/)
- [InVision AG](https://www.ivx.com/)
- [Ubie](https://ubiehealth.com/)
- [Shogun Labs, Inc](https://getshogun.com/)
- [Underbelly](https://www.underbelly.is/)
- [Principal Financial Group](https://www.principal.com/about-us)
- [Suhail Doshi](https://twitter.com/suhail)

If you enjoy Prettier and would like to support our work, consider sponsoring us directly via [our OpenCollective](https://opencollective.com/prettier) or by sponsoring the projects we depend on, including [typescript-eslint](https://opencollective.com/typescript-eslint), [remark](https://opencollective.com/unified), and [Babel](https://opencollective.com/babel).
2 changes: 1 addition & 1 deletion changelog_unreleased/cli/10274.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Add `--no-plugin-search` to turn off plugin autoloading (#10274 by @fisker)
#### Add `--no-plugin-search` option to turn off plugin autoloading (#10274 by @fisker)

To turn off plugin autoloading, use `--no-plugin-search` when using Prettier CLI or add `{ pluginSearchDirs: false }` to options in `prettier.format()` or to the config file.

Expand Down
4 changes: 2 additions & 2 deletions changelog_unreleased/css/12210.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Preserve empty line in CSS paren groups (#12210 by @duailibe)
#### Preserve blank lines in SCSS maps (#12210 by @duailibe)

<!-- Optional description if it makes sense. -->
This change also applies to some PostCSS features with similar syntax.

<!-- prettier-ignore -->
```css
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/html/6644.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Enforce Single Attribute Per Line (#6644 by @kankje)
#### [HIGHLIGHT]Enforce Single Attribute Per Line (#6644 by @kankje)

Added the `singleAttributePerLine` option for specifying if Prettier should enforce single attribute per line in HTML, Vue and JSX.

Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/12017.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### Preserve end-of-line comment for if statements without blocks (#12017 by @sosukesuzuki)
#### Preserve end-of-line comments after if statements without blocks (#12017 by @sosukesuzuki)

<!-- prettier-ignore -->
```jsx
Expand Down
4 changes: 1 addition & 3 deletions changelog_unreleased/javascript/12075.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#### Print end-of-line comment for `continue`/`break` statements (#12075 by @sosukesuzuki)

<!-- Optional description if it makes sense. -->
#### Print end-of-line comments for `continue`/`break` statements (#12075 by @sosukesuzuki)

<!-- prettier-ignore -->
```jsx
Expand Down
6 changes: 3 additions & 3 deletions changelog_unreleased/javascript/12241.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#### Support Unicode Set Notation proposal (#12241 by @fisker)
#### Add support for Unicode Set Notation in regular expressions (#12241 by @fisker)

Support [Stage 3 proposal Unicode Set Notation](https://github.com/tc39/proposal-regexp-set-notation/) via [Babel 7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0).
The Stage 3 proposal for [Unicode Set Notation](https://github.com/tc39/proposal-regexp-set-notation/) in regular expressions is now supported via [Babel 7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0).

See [the release blog post of Babel v7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0#regexp-set-notation-and-properties-of-strings-14125httpsgithubcombabelbabelpull14125) and [the README of this proposal](https://github.com/tc39/proposal-regexp-set-notation/) for details.
See [the release blog post of Babel v7.17.0](https://babeljs.io/blog/2022/02/02/7.17.0#regexp-set-notation-and-properties-of-strings-14125httpsgithubcombabelbabelpull14125) and [the README of this proposal](https://github.com/tc39/proposal-regexp-set-notation/) for details. Also keep in mind our [policy on non-standardized syntax](https://prettier.io/docs/en/rationale.html#disclaimer-about-non-standard-syntax) before using this proposed syntax feature with Prettier.

<!-- prettier-ignore -->
```jsx
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/12268.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Props =
};
```

And for TS that comment would not be stable with a second format:
This change also fixes an issue where a similarly-placed comment in TypeScript would be moved again after a second formatting operation:

<!-- prettier-ignore -->
```ts
Expand Down
4 changes: 2 additions & 2 deletions changelog_unreleased/javascript/12276.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Support destructuring private proposal (#12276 by @sosukesuzuki)
#### Add support for destructuring of private fields (#12276 by @sosukesuzuki)

Support [Stage 2 TC39 proposal destructuring private fields](https://github.com/tc39/proposal-destructuring-private) via [Babel 7.17](https://babeljs.io/blog/2022/02/02/7.17.0).
The Stage 2 TC39 proposal for [destructuring of private fields](https://github.com/tc39/proposal-destructuring-private) is now supported via [Babel 7.17](https://babeljs.io/blog/2022/02/02/7.17.0). Please read our [policy on non-standardized syntax](https://prettier.io/docs/en/rationale.html#disclaimer-about-non-standard-syntax) before you decide to use this proposed syntax feature with Prettier.

<!-- prettier-ignore -->
```jsx
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/12299.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Support decorator auto accessors syntax (#12299 by @sosukesuzuki)

Support auto accessors syntax that is introduced in [new decorators proposal](https://github.com/tc39/proposal-decorators).
Support auto accessors syntax that is introduced in [new decorators proposal](https://github.com/tc39/proposal-decorators). Please read our [policy on non-standardized syntax](https://prettier.io/docs/en/rationale.html#disclaimer-about-non-standard-syntax) before you decide to use this proposed syntax feature with Prettier.

<!-- prettier-ignore -->
```jsx
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions changelog_unreleased/misc/12055.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Switch to `esbuild` (#12055 by @fisker)

We've switched our build process from Rollup to [esbuild](https://esbuild.github.io). esbuild is much faster and has improved our development experience. This is an internal change and should not affect users. If something isn’t working for you after upgrading, please [open an issue](https://github.com/prettier/prettier/issues/new?assignees=&labels=&template=integration.md)!
2 changes: 1 addition & 1 deletion changelog_unreleased/typescript/12351.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Refactor printing definite assignment assertions (#12351 by @thorn0)

Also now definite assignment assertions are printed even when they aren't followed by type annotations, which is an error in TS but not a parse error.
Definite assignment assertions are now printed even when they aren't followed by type annotations. This is an error in TypeScript, but TS is still able to parse the file.

<!-- prettier-ignore -->
```ts
Expand Down
4 changes: 2 additions & 2 deletions changelog_unreleased/typescript/12390.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### Print trailing comma for rest elements in tuple types (#12390 by @sosukesuzuki)

TypeScript allows to put rest elements in places other than the end of tuple types since [4.2](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#leadingmiddle-rest-elements-in-tuple-types).
Prettier now prints a trailing comma for the trailing rest element as the it may be followed by the next element.
TypeScript has allowed rest elements in tuple types (`...T`) to have normal elements come after them since [TypeScript 4.2](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#leadingmiddle-rest-elements-in-tuple-types).
Prettier now prints a trailing comma for the trailing rest element (when trailing commas are enabled) for consistency and to reduce diffs if you decide to add more elements after the final element in the future.

<!-- prettier-ignore -->
```tsx
Expand Down
3 changes: 3 additions & 0 deletions changelog_unreleased/typescript/12400.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### [HIGHLIGHT]TypeScript 4.6 support (#12400 by @dependabot)

We’ve updated the version of TypeScript that we use to parse TS code to [TypeScript 4.6](https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/). However, no new syntax was added in this release of TypeScript so we have not had to make any other changes.
3 changes: 3 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"doctag",
"Dodds",
"Dolzhykov",
"Doshi",
"dotfile",
"dotfiles",
"duailibe",
Expand Down Expand Up @@ -309,6 +310,7 @@
"Stylesheet",
"subvalue",
"suchipi",
"Suhail",
"supertypes",
"Supprimer",
"swcrc",
Expand All @@ -327,6 +329,7 @@
"typecasted",
"typecheck",
"typeof",
"Ubie",
"Umidbek",
"unaries",
"uncook",
Expand Down
14 changes: 11 additions & 3 deletions scripts/draft-blog-post.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const categories = [
{ dir: "yaml", title: "YAML" },
{ dir: "api", title: "API" },
{ dir: "cli", title: "CLI" },
{ dir: "misc", title: "Miscellaneous" },
];

const categoriesByDir = new Map(
Expand All @@ -68,12 +69,17 @@ for (const dir of changelogUnreleasedDirs) {

rimraf.sync(postGlob);

const introFileData = fs.readFileSync(introFile, "utf8").trim();

const TRUNCATE_COMMENT = "<!--truncate-->";
const shouldPrintTruncate = introFileData.includes(TRUNCATE_COMMENT);

fs.writeFileSync(
postFile,
replaceVersions(
[
fs.readFileSync(introFile, "utf8").trim(),
"<!--truncate-->",
introFileData,
shouldPrintTruncate ? TRUNCATE_COMMENT : "",
...printEntriesWithTitle({
title: "Highlights",
filter: (entry) => entry.section === "highlight",
Expand All @@ -90,7 +96,9 @@ fs.writeFileSync(
title: "Other Changes",
filter: (entry) => !entry.section,
}),
].join("\n\n") + "\n",
]
.filter(Boolean)
.join("\n\n") + "\n",
previousVersion,
version
)
Expand Down
1 change: 1 addition & 0 deletions scripts/utils/changelog-categories.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export const CHANGELOG_CATEGORIES = [
"typescript",
"vue",
"yaml",
"misc",
];
Loading

0 comments on commit eb671dd

Please sign in to comment.