Skip to content

Commit

Permalink
edit entries, regenerate the post
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 committed Mar 21, 2020
1 parent a44fc6f commit 3c5f141
Show file tree
Hide file tree
Showing 26 changed files with 316 additions and 196 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.
4 changes: 2 additions & 2 deletions changelog_unreleased/api/pr-6993.md
@@ -1,10 +1,10 @@
#### [BREAKING] Remove deprecated API ([#6993](https://github.com/prettier/prettier/pull/6993) by [@fisker](https://github.com/fisker))
#### [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.<br>
Use `isPreviousLineEmpty(text, node, locStart)` instead of `isNextLineEmpty(text, node, options)`.
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)`.
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
2 changes: 1 addition & 1 deletion changelog_unreleased/javascript/pr-6685.md
@@ -1,4 +1,4 @@
#### Improved 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-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-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
11 changes: 5 additions & 6 deletions changelog_unreleased/javascript/pr-7791.md
@@ -1,6 +1,8 @@
#### Ultimate fix for Closure-style type casts ([#7791](https://github.com/prettier/prettier/pull/7791) by [@thorn0](https://github.com/thorn0))
#### [HIGHLIGHT] Ultimate fix for Closure-style type casts ([#7791](https://github.com/prettier/prettier/pull/7791) by [@thorn0](https://github.com/thorn0), [#7011](https://github.com/prettier/prettier/pull/7011) by [@evilebottnawi](https://github.com/evilebottnawi))

Prettier has been trying not to corrupt these JSDoc type assertions since [v1.6.0](https://prettier.io/blog/2017/08/29/1.6.0.html#handle-closure-compiler-type-cast-syntax-correctly-2484httpsgithubcomprettierprettierpull2484-by-yangsuhttpsgithubcomyangsu), with mixed results. As type checking based on JSDoc becomes increasingly common, we've been getting new bug reports about this syntax. The bugs were tricky because the required parentheses around the expression weren't part of the AST, so Prettier didn't have a good way to detect their presence. Finally, we used the `createParenthesizedExpressions` option of the Babel parser to represent parentheses in the AST using non-standard nodes. This helped fix all the reported bugs.
Prettier has been trying not to corrupt these JSDoc type assertions since [v1.6.0](https://prettier.io/blog/2017/08/29/1.6.0.html#handle-closure-compiler-type-cast-syntax-correctly-2484httpsgithubcomprettierprettierpull2484-by-yangsuhttpsgithubcomyangsu), with mixed results. As type checking based on JSDoc becomes increasingly common, we've been getting new bug reports about this syntax. The bugs were tricky because the required parentheses around the expression weren't part of the AST, so Prettier didn't have a good way to detect their presence.

Finally, we used the `createParenthesizedExpressions` option of the Babel parser to represent parentheses in the AST using non-standard nodes. This helped fix all the reported bugs.

Consequently, Prettier won't recognize JSDoc type casts if the `flow` or `typescript` parser is used, but this is reasonable as this syntax makes little sense in Flow and TypeScript files.

Expand All @@ -18,7 +20,4 @@ const nestedAssertions /** @type {MyType} */ /** @type {unknown} */ = x;
const nestedAssertions = /** @type {MyType} */ (/** @type {unknown} */ (x));
```

Reference documentation for this syntax:

- [Closure Compiler](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#type-type)
- [TypeScript (with `--checkJs`)](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#casts)
Reference documentation for this syntax: [Closure Compiler](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#type-type), [TypeScript (with `--checkJs`)](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#casts).
2 changes: 1 addition & 1 deletion changelog_unreleased/less/pr-6981.md
@@ -1,6 +1,6 @@
#### Fix multiple long-standing issues by updating `postcss-less` ([#6981](https://github.com/prettier/prettier/pull/6981) by [@fisker](https://github.com/fisker), [#7021](https://github.com/prettier/prettier/pull/7021) by [@evilebottnawi](https://github.com/evilebottnawi), [@thorn0](https://github.com/thorn0))

- [`each`](http://lesscss.org/functions/#list-functions-each) is supported now ([#5653](https://github.com/prettier/prettier/issues/5653).
- [`each`](http://lesscss.org/functions/#list-functions-each) is supported now ([#5653](https://github.com/prettier/prettier/issues/5653)).
- `!important` was being moved out of mixin call parameters ([#3544](https://github.com/prettier/prettier/issues/3544)).
- Comments in rulesets passed to mixin calls caused duplicate semicolons ([#3096](https://github.com/prettier/prettier/issues/3096)).
- `::before` was broken in mixin call parameters ([#5791](https://github.com/prettier/prettier/issues/5791)).
2 changes: 1 addition & 1 deletion changelog_unreleased/markdown/pr-7203.md
@@ -1,4 +1,4 @@
#### Fix incorrect prettification of multi-line markdown footnote ([#7203](https://github.com/prettier/prettier/pull/7203) by [@sasurau4](https://github.com/sasurau4))
#### Fix formatting of multi-line footnote ([#7203](https://github.com/prettier/prettier/pull/7203) by [@sasurau4](https://github.com/sasurau4))

<!-- prettier-ignore -->
```md
Expand Down
4 changes: 0 additions & 4 deletions changelog_unreleased/mdx/pr-6949.md
Expand Up @@ -21,10 +21,6 @@ parsable as HTML, such as `<Tag value={{a: 'b'}}>test</Tag>`

SyntaxError: Unexpected closing tag "Tag". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (1:35)
> 1 | <Tag value={ {a : 'b' } }>test</ Tag>
| ^
2 |
3 | <Foo bg={ 'red' } >
4 | <div style={{ display: 'block'} }>

<!-- Prettier master -->

Expand Down
4 changes: 1 addition & 3 deletions changelog_unreleased/scss/pr-7211.md
@@ -1,6 +1,4 @@
#### Fix scss variable string concatenation removing spaces ([#7211](https://github.com/prettier/prettier/pull/7211) by [@sasurau4](https://github.com/sasurau4))

Previously, when Prettier format the scss variable string concatenation, it would remove spaces. Now, Prettier insert spaces around plus operator.
#### Fix whitespace in SCSS concatenation ([#7211](https://github.com/prettier/prettier/pull/7211) by [@sasurau4](https://github.com/sasurau4))

<!-- prettier-ignore -->
```scss
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/typescript/pr-6400.md
@@ -1,3 +1,3 @@
#### Babel as an alternative parser for TypeScript ([#6400](https://github.com/prettier/prettier/pull/6400) by [@JounQin](https://github.com/JounQin) & [@thorn0](https://github.com/thorn0))

A new value for the `parser` option has been added: `babel-ts`, which makes use of Babel’s TypeScript plugin. The `babel-ts` parser supports JavaScript features not yet supported by TypeScript (ECMAScript proposals, e.g. [private methods and accessors](https://github.com/tc39/proposal-private-methods)), but it's less permissive when it comes to error recovery and less battle-tested than the `typescript` parser. While Babel’s TypeScript plugin is quite mature, ASTs produced by the two parsers aren't 100% compatible. We tried to take the discrepancies into account, but there are most likely still cases where code gets formatted differently or even incorrectly. We call upon the you, our users, to help us find such cases. If you see them, please raise issues. In the long run, this will help with [unifying the AST format](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/typescript-estree#ast-alignment-tests) in future versions of the parsers and thus contribute to a better, more solid JavaScript parser ecosystem.
A new value for the `parser` option has been added: `babel-ts`, which makes use of Babel’s TypeScript plugin. The `babel-ts` parser supports JavaScript features not yet supported by TypeScript (ECMAScript proposals, e.g. [private methods and accessors](https://github.com/tc39/proposal-private-methods)), but it's less permissive when it comes to error recovery and less battle-tested than the `typescript` parser. While Babel’s TypeScript plugin is quite mature, ASTs produced by the two parsers aren't 100% compatible. We tried to take the discrepancies into account, but there are most likely still cases where code gets formatted differently or even incorrectly. We call upon you, our users, to help us find such cases. If you see them, please raise issues. In the long run, this will help with [unifying the AST format](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/typescript-estree#ast-alignment-tests) in future versions of the parsers and thus contribute to a better, more solid JavaScript parser ecosystem.
3 changes: 2 additions & 1 deletion changelog_unreleased/typescript/pr-7144.md
@@ -1,4 +1,4 @@
#### Fix formatting comments for function-like nodes ([#7144](https://github.com/prettier/prettier/pull/7144) by [@armano2](https://github.com/armano2))
#### Fix formatting of comments for function-like nodes ([#7144](https://github.com/prettier/prettier/pull/7144) by [@armano2](https://github.com/armano2))

<!-- prettier-ignore -->
```ts
Expand Down Expand Up @@ -54,6 +54,7 @@ let foo9: new (/* bar */) => /* foo */ /* baz */ string;
let foo10: new (/* foo */ a: /* bar */ string) => /* baz */ string;
```
<!-- prettier-ignore -->
```ts
// Input
abstract class Test {
Expand Down
2 changes: 1 addition & 1 deletion changelog_unreleased/typescript/pr-7631.md
@@ -1,4 +1,4 @@
#### TypeScript 3.8 ([#7631](https://github.com/prettier/prettier/pull/7631) by [@thorn0](https://github.com/thorn0), [#7764](https://github.com/prettier/prettier/pull/7764) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#7804](https://github.com/prettier/prettier/pull/7804) by [@sosukesuzuki](https://github.com/sosukesuzuki))
#### [HIGHLIGHT] TypeScript 3.8 ([#7631](https://github.com/prettier/prettier/pull/7631) by [@thorn0](https://github.com/thorn0), [#7764](https://github.com/prettier/prettier/pull/7764) by [@sosukesuzuki](https://github.com/sosukesuzuki), [#7804](https://github.com/prettier/prettier/pull/7804) by [@sosukesuzuki](https://github.com/sosukesuzuki))

Prettier now supports the new syntax added in TypeScript 3.8:

Expand Down

0 comments on commit 3c5f141

Please sign in to comment.