From 8a4b34d2a48e2684f2ce8e079f595bde4fa47734 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 28 Aug 2019 15:03:41 -0500 Subject: [PATCH] Add changelog entry for ?? precedence update (#6430) --- CHANGELOG.unreleased.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 71d5e701..07883ba2 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -239,6 +239,24 @@ Previously, Prettier would sometimes ignore whitespace when formatting comments. ``` +#### JavaScript: Update ?? precedence to match stage 3 proposal ([#6404] by [@vjeux]) + +We've updated Prettier's support for the nullish coalescing operator to match a spec update that no longer allows it to immediately contain, or be contained within an `&&` or `||` operation. + + +```js +// Input +(foo ?? baz) || baz; + +// Output (Prettier stable) +foo ?? baz || baz; + +// Output (Prettier master) +(foo ?? baz) || baz; +``` + +Please note, as we update our parsers with versions that support this spec update, code without the parenthesis will throw a parse error. + #### JavaScript: Keep unary expressions parentheses with comments ([#6217] by [@sosukesuzuki]) Previously, Prettier removes parentheses enclose unary expressions. This change modify to keep it when the expression has comments.