Release 1.16.2

master
Ika 2019-01-30 16:23:45 +08:00
parent 47da0804a9
commit 3c56b9ad18
7 changed files with 62 additions and 47 deletions

View File

@ -26,7 +26,7 @@ Tip! Don't write this stuff manually.
-->
**Prettier 1.16.1**
**Prettier 1.16.2**
[Playground link](https://prettier.io/playground/#.....)
```sh
# Options (if any):

View File

@ -19,7 +19,7 @@ BEFORE SUBMITTING AN ISSUE:
-->
**Environments:**
- Prettier Version: 1.16.1
- Prettier Version: 1.16.2
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
- Runtime: <!-- Node.js v6, Chrome v67, etc. -->
- Operating System: <!-- Windows, Linux, macOS, etc. -->

View File

@ -1,3 +1,57 @@
# 1.16.2
[diff](https://github.com/prettier/prettier/compare/1.16.1...1.16.2)
- CLI: Fix CI detection to avoid unwanted TTY behavior ([#5804] by [@kachkaev])
In Prettier 1.16.0 and 1.16.1, `--list-different` and `--check` logged every file in some CI environments, instead of just unformatted files.
This unwanted behavior is now fixed.
- HTML: Do not format non-normal whitespace as normal whitespace ([#5797] by [@ikatyang])
Previously, only non-breaking whitespaces (U+00A0) are marked as non-normal whitespace,
which means other non-normal whitespaces such as non-breaking narrow whitespaces (U+202F)
could be formatted as normal whitespaces, which breaks the output. We now follow the spec to
exclude all non-[ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace) from whitespace normalization.
(`·` represents a non-breaking narrow whitespace)
<!-- prettier-ignore -->
```html
<!-- Input -->
Prix·:·32·€
<!-- Output (Prettier 1.16.1) -->
Prix : 32 €
<!-- Output (Prettier 1.16.2) -->
Prix·:·32·€
```
- JavaScript: Fix record type cast comment detection ([#5793] by [@yangsu])
Previously, type cast comments with record types were ignored and prettier
stripped the subsequent parens. Prettier 1.16.2 handles these cases correctly.
<!-- prettier-ignore -->
```js
// Input
const v = /** @type {{key: number}} */ (value);
// Output (Prettier 1.16.1)
const v = /** @type {{key: number}} */ value;
// Output (Prettier 1.16.2)
const v = /** @type {{key: number}} */ (value);
```
[@ikatyang]: https://github.com/ikatyang
[@kachkaev]: https://github.com/kachkaev
[@yangsu]: https://github.com/yangsu
[#5793]: https://github.com/prettier/prettier/pull/5793
[#5797]: https://github.com/prettier/prettier/pull/5797
[#5804]: https://github.com/prettier/prettier/pull/5804
# 1.16.1
[diff](https://github.com/prettier/prettier/compare/1.16.0...1.16.1)

View File

@ -41,46 +41,3 @@ Examples:
```
-->
- CLI: Fix CI detection to avoid unwanted TTY behavior ([#5804] by [@kachkaev])
In Prettier 1.16.0 and 1.16.1, `--list-different` and `--check` logged every file in some CI environments, instead of just unformatted files.
This unwanted behavior is now fixed.
- HTML: Do not format non-normal whitespace as normal whitespace ([#5797] by [@ikatyang])
Previously, only non-breaking whitespaces (U+00A0) are marked as non-normal whitespace,
which means other non-normal whitespaces such as non-breaking narrow whitespaces (U+202F)
could be formatted as normal whitespaces, which breaks the output. We now follow the spec to
exclude all non-[ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace) from whitespace normalization.
(`·` represents a non-breaking narrow whitespace)
<!-- prettier-ignore -->
```html
<!-- Input -->
Prix·:·32·€
<!-- Output (Prettier stable) -->
Prix : 32 €
<!-- Output (Prettier master) -->
Prix·:·32·€
```
- JavaScript: fix record type cast comment detection ([#5793] by [@yangsu])
Previously, type cast comments with record types were ignored and prettier
stripped the subsequent parens. Prettier master handles these cases correctly.
<!-- prettier-ignore -->
```js
// Input
const v = /** @type {{key: number}} */ (value);
// Output (Prettier stable)
const v = /** @type {{key: number}} */ value;
// Output (Prettier master)
const v = /** @type {{key: number}} */ (value);
```

View File

@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "1.17.0-dev",
"version": "1.16.2",
"description": "Prettier is an opinionated code formatter",
"bin": {
"prettier": "./bin/prettier.js"

View File

@ -184,7 +184,7 @@ Valid options:
- `"babel"` (via [@babel/parser](https://github.com/babel/babel/tree/master/packages/babel-parser)) _Named `"babylon"` until v1.16.0_
- `"babel-flow"` (Same as `"babel"` but enables Flow parsing explicitly to avoid ambiguity) _First available in v1.16.0_
- `"flow"` (via [flow-parser](https://github.com/facebook/flow/tree/master/src/parser))
- `"typescript"` (via [typescript-estree](https://github.com/JamesHenry/typescript-estree)) _First available in v1.4.0_
- `"typescript"` (via [@typescript-eslint/typescript-estree](https://github.com/typescript-eslint/typescript-eslint)) _First available in v1.4.0_
- `"css"` (via [postcss-scss](https://github.com/postcss/postcss-scss) and [postcss-less](https://github.com/shellscape/postcss-less), autodetects which to use) _First available in v1.7.1_
- `"scss"` (same parsers as `"css"`, prefers postcss-scss) _First available in v1.7.1_
- `"less"` (same parsers as `"css"`, prefers postcss-less) _First available in v1.7.1_

View File

@ -246,6 +246,10 @@ isPreviousLineEmpty(text: string, node: object, options: object): boolean;
mapDoc(doc: object, callback: function): void;
```
### Tutorials
- [How to write a plugin for Prettier](https://medium.com/@fvictorio/how-to-write-a-plugin-for-prettier-a0d98c845e70): Teaches you how to write a very basic Prettier plugin for TOML.
## Testing Plugins
Since plugins can be resolved using relative paths, when working on one you can do: