Skip to content

Commit

Permalink
Blog post for 2.0 (#7417)
Browse files Browse the repository at this point in the history
* add a script that concatenates changelog_unreleased into a blog post draft

* syntax highlighting issues

* generate post draft

* Copy edit, remove error stacks

* Update 2020-00-00-2.0.0.md

* Update changelog source files

* edit entries, regenerate the post

* add lost file in versioned_docs

Co-authored-by: Jed Fox <git@twopointzero.us>
  • Loading branch information
thorn0 and j-f1 committed Mar 21, 2020
1 parent 9dad95b commit 8334610
Show file tree
Hide file tree
Showing 41 changed files with 2,194 additions and 148 deletions.
2 changes: 1 addition & 1 deletion changelog_unreleased/angular/pr-7371.md
@@ -1,4 +1,4 @@
#### Fix formatting i18n attributes ([#7371](https://github.com/prettier/prettier/pull/7371) by [@thorn0](https://github.com/thorn0))
#### Fix formatting of i18n attributes ([#7371](https://github.com/prettier/prettier/pull/7371) by [@thorn0](https://github.com/thorn0))

Prettier 1.19 [added](https://prettier.io/blog/2019/11/09/1.19.0.html#add-formatting-for-i18n-attributes-6695-by-voithos)
support for formatting [i18n attributes](https://angular.io/guide/i18n), but putting the closing quote mark on a new line
Expand Down
2 changes: 2 additions & 0 deletions changelog_unreleased/api/pr-5813.md
@@ -1 +1,3 @@
#### [BREAKING] Fix config overrides pattern matching to include dot files ([#5813](https://github.com/prettier/prettier/pull/5813) by [@chrisblossom](https://github.com/chrisblossom))

Previously, [configuration overrides](/docs/en/configuration.html#configuration-overrides) weren't applied to files whose name had a leading dot.
25 changes: 7 additions & 18 deletions changelog_unreleased/api/pr-6993.md
@@ -1,21 +1,10 @@
#### [BREAKING] Remove deprecated API ([#6993](https://github.com/prettier/prettier/pull/6993) by [@fisker](https://github.com/fisker))

- Parser `typescript-eslint` is removed.

Use `typescript` instead.

- `prettier.util.mapDoc` is removed

Use `prettier.doc.utils.mapDoc` instead.

- `prettier.util.isNextLineEmpty` is updated
#### [BREAKING] Remove deprecated API and change util signatures ([#6993](https://github.com/prettier/prettier/pull/6993) by [@fisker](https://github.com/fisker))

- Parser `typescript-eslint` is removed. Use the `typescript` parser instead.
- `prettier.util.mapDoc` is removed. Use `prettier.doc.utils.mapDoc` instead.
- `prettier.util.isNextLineEmpty` is updated.<br>
Use `isNextLineEmpty(text, node, locEnd)` instead of `isNextLineEmpty(text, node, options)`.

- `prettier.util.isPreviousLineEmpty` is updated

Use `isPreviousLineEmpty(text, node, locStart)` instead of `isNextLineEmpty(text, node, options)`.

- `prettier.util.getNextNonSpaceNonCommentCharacterIndex` is updated

- `prettier.util.isPreviousLineEmpty` is updated.<br>
Use `isPreviousLineEmpty(text, node, locStart)` instead of `isPreviousLineEmpty(text, node, options)`.
- `prettier.util.getNextNonSpaceNonCommentCharacterIndex` is updated.<br>
Use `getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd)` instead of `getNextNonSpaceNonCommentCharacterIndex(text, node, options)`.
8 changes: 4 additions & 4 deletions changelog_unreleased/api/pr-7430.md
@@ -1,7 +1,7 @@
#### [BREAKING] Change default value for `arrowParens` to `always` ([#7430](https://github.com/prettier/prettier/pull/7430) by [@kachkaev](https://github.com/kachkaev))

[Since version 1.9](https://prettier.io/blog/2017/12/05/1.9.0.html#option-to-add-parens-in-arrow-function-arguments-3324httpsgithubcomprettierprettierpull3324-by-rattrayalexhttpsgithubcomrattrayalex-and-suchipihttpsgithubcomsuchipi), Prettier has an [option](https://prettier.io/docs/en/options.html#arrow-function-parentheses) to always wrap arrow function arguments with parentheses.
Since version 2.0, this behavior becomes default.
[Since version 1.9](https://prettier.io/blog/2017/12/05/1.9.0.html#option-to-add-parens-in-arrow-function-arguments-3324httpsgithubcomprettierprettierpull3324-by-rattrayalexhttpsgithubcomrattrayalex-and-suchipihttpsgithubcomsuchipi), Prettier has had an [option](https://prettier.io/docs/en/options.html#arrow-function-parentheses) to always wrap arrow function arguments with parentheses.
In version 2.0, this behavior has become the default.

<!-- prettier-ignore -->
```js
Expand All @@ -15,8 +15,8 @@ const fn = x => y => x + y;
const fn = (x) => (y) => x + y;
```

At first glance, avoiding parentheses in the isolated example above may look like a better choice because of less visual noise.
However, when Prettier removes parentheses, it becomes harder to add type annotations, extra arguments or default values as well as making [other changes](https://twitter.com/ManuelBieh/status/1181880524954050560).
At first glance, avoiding parentheses in the isolated example above may look like a better choice because it results in less visual noise.
However, when Prettier removes parentheses, it becomes harder to add type annotations, extra arguments, default values, or a variety of [other things](https://twitter.com/ManuelBieh/status/1181880524954050560).
Consistent use of parentheses provides a better developer experience when editing real codebases, which justifies the change.

You are encouraged to use the new default value, but if the old behavior is still preferred, please configure Prettier with `{ "arrowParens": "avoid" }`.
8 changes: 4 additions & 4 deletions changelog_unreleased/api/pr-7435.md
Expand Up @@ -3,11 +3,11 @@
Early versions of Prettier were formatting all files with the \*nix flavor of [line endings](https://en.wikipedia.org/wiki/Newline) (`\n`, also known as `LF`).
This behavior was changed in [#472](https://github.com/prettier/prettier/pull/472), which allowed preserving Windows line endings (`\r\n`, also known as `CRLF`).

[Since Prettier version 1.15](https://prettier.io/blog/2018/11/07/1.15.0.html#add-an-option-to-enforce-line-endings-5327-by-kachkaev), the flavor of line endings is configurable via the `endOfLine` option.
The default value was set to `auto` for backwards compatibility, which meant that Prettier preserved a flavor of line endings already present in a given file.
[Since Prettier version 1.15](https://prettier.io/blog/2018/11/07/1.15.0.html#add-an-option-to-enforce-line-endings-5327-by-kachkaev), the flavor of line endings has been configurable via the `endOfLine` option.
The default value was set to `auto` for backwards compatibility, which meant that Prettier preserved whichever flavor of line endings was already present in a given file.

With `endOfLine` equal to `auto`, Prettier converted mixed line endings within one file to what was found at the end of the first line.
However, line endings in neighboring files could still remain inconsistent.
That meant Prettier converted mixed line endings within one file to what was found at the end of the first line.
However, line endings in separate files could still remain inconsistent.
Besides, contributors on different operating systems could accidentally change line endings in previously committed files and this would be fine with Prettier.
Doing so would produce a large `git diff` and thus make the line-by-line history for a file (`git blame`) harder to explore.

Expand Down
4 changes: 2 additions & 2 deletions changelog_unreleased/api/pr-7485.md
@@ -1,3 +1,3 @@
#### Cache plugins search result ([#7485](https://github.com/prettier/prettier/pull/7485) by [@fisker](https://github.com/fisker))
#### [BREAKING] Cache plugin search results ([#7485](https://github.com/prettier/prettier/pull/7485) by [@fisker](https://github.com/fisker))

Previously, we search plugins on every `format` call, the plugins search result is cached since v2.0.0, cache can be clear by calling `prettier.clearConfigCache()`.
Previously, Prettier searched the file system for plugins on every `prettier.format` call. Now, search results are cached. The cache can be cleared by calling `prettier.clearConfigCache()`.
12 changes: 6 additions & 6 deletions changelog_unreleased/api/pr-7511.md
@@ -1,8 +1,8 @@
#### Remove deprecated options and option values ([#7511](https://github.com/prettier/prettier/pull/7511), [#7533](https://github.com/prettier/prettier/pull/7533), [#7535](https://github.com/prettier/prettier/pull/7535), [#7536](https://github.com/prettier/prettier/pull/7536) by [@fisker](https://github.com/fisker))
#### [BREAKING] Remove deprecated options and option values ([#7511](https://github.com/prettier/prettier/pull/7511), [#7533](https://github.com/prettier/prettier/pull/7533), [#7535](https://github.com/prettier/prettier/pull/7535), [#7536](https://github.com/prettier/prettier/pull/7536) by [@fisker](https://github.com/fisker))

- Options:
- `useFlowParser` (`--flow-parser` in CLI) [has been deprecated since `v0.0.10`](https://github.com/prettier/prettier/blob/master/CHANGELOG.md#0010).
- Renamed option values whose old names were kept for backward compatibility:
- `parser`: `babylon` (renamed to `babel` in _v1.16.0_), `postcss` (renamed to `css` in _v1.7.1_)
- `trailingComma`: `true` (renamed to `always` in _v1.9.0_), `false` (renamed to `never` in _v1.9.0_)
- `proseWrap`: `true` (renamed to `es5` in _v0.19.0_), `false` (renamed to `none` in _v0.19.0_)
- `useFlowParser` (`--flow-parser` in CLI) has been deprecated [since `v0.0.10`](https://github.com/prettier/prettier/blob/master/CHANGELOG.md#0010).
- Option values:
- `parser`: `babylon` (renamed to `babel` in v1.16.0), `postcss` (renamed to `css` in v1.7.1)
- `proseWrap`: `true` (renamed to `always` in v1.9.0), `false` (renamed to `never` in v1.9.0)
- `trailingComma`: `true` (renamed to `es5` in v0.19.0), `false` (renamed to `none` in v0.19.0)
4 changes: 2 additions & 2 deletions changelog_unreleased/api/pr-7620.md
@@ -1,3 +1,3 @@
#### [BREAKING] Remove the `version` parameter of `prettier.getSupportInfo()` ([#7620](https://github.com/prettier/prettier/pull/7620) by [@thorn0](https://github.com/thorn0))
#### [BREAKING] Remove the `version` parameter of `prettier.getSupportInfo` ([#7620](https://github.com/prettier/prettier/pull/7620) by [@thorn0](https://github.com/thorn0))

In Prettier 1.x (since 1.8.0), it was possible to pass a version number to `prettier.getSupportInfo()` to get information on the languages, options, etc. supported by previous versions. This interesting but apparently not very useful API kept causing maintenance problems and has been removed in Prettier 2.0.0.
Since Prettier 1.8.0, it was possible to pass a version number to `prettier.getSupportInfo` to get information on the languages, options, etc. supported by previous versions. This interesting but apparently not very useful API kept causing maintenance problems and has been removed in Prettier 2.0.0.
7 changes: 7 additions & 0 deletions changelog_unreleased/blog-post-intro.md
@@ -0,0 +1,7 @@
---
author: "Georgii Dolzhykov (@thorn0)"
authorURL: "https://github.com/thorn0"
title: "Prettier 2.0 “2020”"
---

Better defaults, a better CLI and better heuristics. Oh, and TypeScript 3.8.
2 changes: 1 addition & 1 deletion changelog_unreleased/cli/pr-7587.md
@@ -1,3 +1,3 @@
#### Test whether passed globs are names of existing files before treating them as globs ([#7587](https://github.com/prettier/prettier/pull/7587) by [@fisker](https://github.com/fisker))
#### [HIGHLIGHT] Test whether passed globs are names of existing files before treating them as globs ([#7587](https://github.com/prettier/prettier/pull/7587) by [@fisker](https://github.com/fisker))

Since file names in Linux can contain almost any characters, strings like `foo*.js` and `[bar].css` are valid file names. Previously, if the user needed to format a file named `[bar].css`, a glob escaping syntax had to be used: `prettier "\[bar].css"` (this one doesn't work on Windows, where backslashes are treated as path separators) or `prettier "[[]bar].css"`. Because of this, important use cases were broken. E.g. [lint-staged](https://github.com/okonet/lint-staged) passes absolute paths and knows nothing about the escaping syntax. Now, when Prettier CLI gets a glob, it first tries to resolve it as a literal file name.
2 changes: 1 addition & 1 deletion changelog_unreleased/cli/pr-7660.md
@@ -1,4 +1,4 @@
#### Expand directories, including `.` ([#7660](https://github.com/prettier/prettier/pull/7660) by [@thorn0](https://github.com/thorn0))
#### [HIGHLIGHT] Expand directories, including `.` ([#7660](https://github.com/prettier/prettier/pull/7660) by [@thorn0](https://github.com/thorn0))

It's finally possible to run `prettier --write .` to format all supported files in the current directory and its subdirectories.
Directory names can be mixed with file names and glob patterns (e.g. `prettier src "test/*.spec.js" foo.js`).
Expand Down
4 changes: 3 additions & 1 deletion changelog_unreleased/flow/pr-7484.md
Expand Up @@ -3,7 +3,9 @@
<!-- prettier-ignore -->
```js
// Input
class Foo {#privateProp: number;}
class Foo {
#privateProp: number;
}

// Prettier stable
class Foo {
Expand Down
1 change: 1 addition & 0 deletions changelog_unreleased/handlebars/pr-7552.md
Expand Up @@ -14,3 +14,4 @@
<ul class="abc
def">
</ul>
```
10 changes: 0 additions & 10 deletions changelog_unreleased/html/pr-7293.md
Expand Up @@ -8,16 +8,6 @@

<!-- Prettier stable -->
TypeError: Cannot read property 'start' of null
at hasTrailingLineBreak (https://prettier.io/lib/standalone.js:19694:169)
at forceBreakContent (https://prettier.io/lib/standalone.js:19668:154)
at Object.genericPrint$2 [as print] (https://prettier.io/lib/standalone.js:21068:126)
at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15302:20)
at https://prettier.io/lib/standalone.js:15253:18
at Object.printComments (https://prettier.io/lib/standalone.js:14974:19)
at printGenerically (https://prettier.io/lib/standalone.js:15252:24)
at printChild (https://prettier.io/lib/standalone.js:21227:14)
at https://prettier.io/lib/standalone.js:21211:104
at FastPath.map (https://prettier.io/lib/standalone.js:15155:23)

<!-- Prettier master -->
<div><span> < </span></div>
Expand Down
10 changes: 0 additions & 10 deletions changelog_unreleased/html/pr-7295.md
Expand Up @@ -11,16 +11,6 @@ srcset="

<!-- Prettier stable -->
Error: Mixed descriptor in srcset is not supported
at printImgSrcset (https://prettier.io/lib/standalone.js:20867:13)
at printEmbeddedAttributeValue (https://prettier.io/lib/standalone.js:21538:26)
at Object.embed$2 [as embed] (https://prettier.io/lib/standalone.js:21009:43)
at Object.printSubtree (https://prettier.io/lib/standalone.js:15170:30)
at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15288:31)
at https://prettier.io/lib/standalone.js:15253:18
at Object.printComments (https://prettier.io/lib/standalone.js:14974:19)
at printGenerically (https://prettier.io/lib/standalone.js:15252:24)
at https://prettier.io/lib/standalone.js:21285:175
at FastPath.map (https://prettier.io/lib/standalone.js:15155:23)

<!-- Prettier master -->
<img srcset="/media/examples/surfer-240-200.jpg" />
Expand Down
12 changes: 1 addition & 11 deletions changelog_unreleased/html/pr-7392.md
@@ -1,4 +1,4 @@
#### Fix error throws on unclosed tag in `pre` tag ([#7392](https://github.com/prettier/prettier/pull/7392) by [@fisker](https://github.com/fisker))
#### Fix error thrown on unclosed tag in `pre` tag ([#7392](https://github.com/prettier/prettier/pull/7392) by [@fisker](https://github.com/fisker))

<!-- prettier-ignore -->
```html
Expand All @@ -8,16 +8,6 @@

<!-- Prettier stable -->
TypeError: Cannot read property 'start' of null
at printChild (https://prettier.io/lib/standalone.js:21224:358)
at https://prettier.io/lib/standalone.js:21211:104
at FastPath.map (https://prettier.io/lib/standalone.js:15155:23)
at printChildren$1 (https://prettier.io/lib/standalone.js:21155:26)
at Object.genericPrint$2 [as print] (https://prettier.io/lib/standalone.js:21039:41)
at callPluginPrintFunction (https://prettier.io/lib/standalone.js:15302:20)
at https://prettier.io/lib/standalone.js:15253:18
at Object.printComments (https://prettier.io/lib/standalone.js:14974:19)
at printGenerically (https://prettier.io/lib/standalone.js:15252:24)
at printAstToDoc (https://prettier.io/lib/standalone.js:15264:15)

<!-- Prettier master -->
<pre><br /></pre>
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/html/pr-7654.md
Expand Up @@ -4,7 +4,7 @@ Previously, it worked only for tags. Useful for protecting various macros and pr

<!-- prettier-ignore -->
```html
<!-- Input -->
<!-- Input -->
<!-- prettier-ignore -->
A super long string that has been marked as ignore because it was probably generated by some script.

Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-6685.md
@@ -1,4 +1,4 @@
#### Method chain breaking heuristic ([#6685](https://github.com/prettier/prettier/pull/6685) by [@mmkal](https://github.com/mmkal))
#### [HIGHLIGHT] Improved method chain breaking heuristic ([#6685](https://github.com/prettier/prettier/pull/6685) by [@mmkal](https://github.com/mmkal))

Previously, any method call chain of length three or longer would be automatically broken into multiple lines. The new heuristic is based on the complexity of the call arguments in the chain, rather than simply on the chain's length. Now, if chained method calls have arguments which aren't easy to understand at a glance (e.g. functions or deeply-nested objects), the chain is broken. Otherwise, they're allowed to remain on one line. See prior issues [#3197](https://github.com/prettier/prettier/issues/3107), [#4765](https://github.com/prettier/prettier/pull/4765), [#1565](https://github.com/prettier/prettier/issues/1565) and [#4125](https://github.com/prettier/prettier/pull/4125) for context and examples.

Expand Down
16 changes: 0 additions & 16 deletions changelog_unreleased/javascript/pr-7011.md

This file was deleted.

2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-7026.md
Expand Up @@ -18,7 +18,7 @@ const averredBathersBoxroomBuggyNurl =
askTrovenaBeenaDependsRowans === 2 ||
glimseGlyphsHazardNoopsTieTie === 3;

// Prettier master (first output)
// Prettier master (first and second outputs)
const averredBathersBoxroomBuggyNurl =
bifornCringerMoshedPerplexSawder === 1 ||
askTrovenaBeenaDependsRowans === 2 ||
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-7138.md
Expand Up @@ -3,7 +3,7 @@
Because decorators modify the line following, splitting a decorator call’s
arguments onto multiple lines can obscure the relationship between the
decorator and its intended target, producing less-readable code. Therefore, the
function composition logic introduced in #6033 has been changed to exclude
function composition logic introduced in [#6033](https://github.com/prettier/prettier/pull/6033) has been changed to exclude
decorator calls.

<!-- prettier-ignore -->
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-7140.md
@@ -1,4 +1,4 @@
#### Fix moving semicolon to trailing comment in `return` ([#7140](https://github.com/prettier/prettier/pull/7140) by [@sosukesuzuki](https://github.com/sosukesuzuki))
#### Correct semicolon placement in empty `return` statement with comment ([#7140](https://github.com/prettier/prettier/pull/7140) by [@sosukesuzuki](https://github.com/sosukesuzuki))

<!-- prettier-ignore -->
```js
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-7367.md
@@ -1,4 +1,4 @@
#### Fix: remove unnecessary parens when yielding JSX ([#7367](https://github.com/prettier/prettier/pull/7367) by [@cola119](https://github.com/cola119))
#### Remove unnecessary parens when yielding JSX ([#7367](https://github.com/prettier/prettier/pull/7367) by [@cola119](https://github.com/cola119))

<!-- prettier-ignore -->
```jsx
Expand Down

0 comments on commit 8334610

Please sign in to comment.