diff --git a/changelog_unreleased/flow/10594.md b/changelog_unreleased/flow/10594.md index 6915326b8..83620ee1f 100644 --- a/changelog_unreleased/flow/10594.md +++ b/changelog_unreleased/flow/10594.md @@ -1,7 +1,5 @@ #### Support for Flow's indexed access type (#10594 by @gkz) -Support for Flow's indexed access type. - ```js // Input diff --git a/changelog_unreleased/javascript/10085.md b/changelog_unreleased/javascript/10085.md index e4899a2f3..59cca3c79 100644 --- a/changelog_unreleased/javascript/10085.md +++ b/changelog_unreleased/javascript/10085.md @@ -2,14 +2,6 @@ ```ts -// Input -class loooooooooooooooooooong - extends looooooooooooooooooong - implements loooooooooooooooooooong -{ - property: string; -} - // Prettier stable class loooooooooooooooooooong extends looooooooooooooooooong @@ -24,5 +16,4 @@ class loooooooooooooooooooong { property: string; } - ``` diff --git a/changelog_unreleased/javascript/10106.md b/changelog_unreleased/javascript/10106.md index cacf58331..40dc9dcff 100644 --- a/changelog_unreleased/javascript/10106.md +++ b/changelog_unreleased/javascript/10106.md @@ -26,11 +26,10 @@ const lazyCatererNumbers = [ 22, 29, 37, - // ... ✂ a lot of lines ✂ ... + // ... ✂ 46 lines ✂ ... 1379, ]; - // Prettier main const lazyCatererNumbers = [ 1, 2, 4, 7, 11, 16, 22, 29, 37, 46, @@ -41,5 +40,4 @@ const lazyCatererNumbers = [ // n > 40 821, 862, 904, 947, 991, 1036, 1082, 1129, 1177, 1226, 1276, 1327, 1379, ]; - ``` diff --git a/changelog_unreleased/javascript/10187.md b/changelog_unreleased/javascript/10187.md index 86db16462..83dd03cbb 100644 --- a/changelog_unreleased/javascript/10187.md +++ b/changelog_unreleased/javascript/10187.md @@ -2,42 +2,23 @@ ```ts -// Input -const dotNotationMemberExpression = ( - callNode.parent?.type === AST_NODE_TYPES.ChainExpression - ? callNode.parent.parent - : callNode.parent -).TSESTree.BinaryExpression; -const computedMemberExpression = ( - callNode.parent?.type === AST_NODE_TYPES.ChainExpression - ? callNode.parent.parent - : callNode.parent -)[TSESTree.BinaryExpression]; -const callExpressionCallee = ( - callNode.parent?.type === AST_NODE_TYPES.ChainExpression - ? callNode.parent.parent - : callNode.parent -)(TSESTree.BinaryExpression); -const typeScriptAsExpression = ( - callNode.parent?.type === AST_NODE_TYPES.ChainExpression - ? callNode.parent.parent - : callNode.parent -) as TSESTree.BinaryExpression; - // Prettier stable const dotNotationMemberExpression = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent : callNode.parent ).TSESTree.BinaryExpression; + const computedMemberExpression = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent : callNode.parent)[TSESTree.BinaryExpression]; + const callExpressionCallee = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent : callNode.parent)(TSESTree.BinaryExpression); + const typeScriptAsExpression = (callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent @@ -49,16 +30,19 @@ const dotNotationMemberExpression = ( ? callNode.parent.parent : callNode.parent ).TSESTree.BinaryExpression; + const computedMemberExpression = ( callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent : callNode.parent )[TSESTree.BinaryExpression]; + const callExpressionCallee = ( callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent : callNode.parent )(TSESTree.BinaryExpression); + const typeScriptAsExpression = ( callNode.parent?.type === AST_NODE_TYPES.ChainExpression ? callNode.parent.parent diff --git a/changelog_unreleased/javascript/10222.md b/changelog_unreleased/javascript/10222.md index 89ae1aa6c..0c2a38082 100644 --- a/changelog_unreleased/javascript/10222.md +++ b/changelog_unreleased/javascript/10222.md @@ -4,22 +4,6 @@ Previously, Prettier had a lot of trouble with figuring out how to break lines i ```ts -// Input -aParticularlyLongAndObnoxiousNameForIllustrativePurposes = - anotherVeryLongNameForIllustrativePurposes; - -aParticularlyLongAndObnoxiousNameForIllustrativePurposes = - 'a very long string for illustrative purposes'.length; - -someReallyLongThingStoredInAMapWithAReallyBigName[pageletID] = - _someVariableThatWeAreCheckingForFalsiness - ? Date.now() - _someVariableThatWeAreCheckingForFalsiness - : 0; - -class x { - private readonly rawConfigFromFile$: BehaviorSubject = new BehaviorSubject(notRead); -} - // Prettier stable aParticularlyLongAndObnoxiousNameForIllustrativePurposes = anotherVeryLongNameForIllustrativePurposes; diff --git a/changelog_unreleased/javascript/10238.md b/changelog_unreleased/javascript/10238.md index c0e1a8e8f..349b2dd34 100644 --- a/changelog_unreleased/javascript/10238.md +++ b/changelog_unreleased/javascript/10238.md @@ -2,12 +2,6 @@ ```js -// Input -const { firstName, lastName } = useMemo( - () => parseFullName(fullName), - [fullName] -); - // Prettier stable const { firstName, lastName } = useMemo(() => parseFullName(fullName), [ fullName, @@ -18,5 +12,4 @@ const { firstName, lastName } = useMemo( () => parseFullName(fullName), [fullName] ); - ``` diff --git a/changelog_unreleased/javascript/10335.md b/changelog_unreleased/javascript/10335.md index c345707bd..3301e0f3b 100644 --- a/changelog_unreleased/javascript/10335.md +++ b/changelog_unreleased/javascript/10335.md @@ -4,11 +4,6 @@ Line breaks after short property names in object literals often look unnatural. ```js -// Input -const importantLink = { - url: "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about" -}; - // Prettier stable const importantLink = { url: diff --git a/changelog_unreleased/javascript/10446.md b/changelog_unreleased/javascript/10446.md index 9ee1f7a94..bbd5a8806 100644 --- a/changelog_unreleased/javascript/10446.md +++ b/changelog_unreleased/javascript/10446.md @@ -1,4 +1,4 @@ -#### Fix missing parentheses for `yield` in `pipeline` (#10446 by @fisker) +#### Fix missing parentheses for `yield` in a pipeline (#10446 by @fisker) ```jsx diff --git a/changelog_unreleased/javascript/10528.md b/changelog_unreleased/javascript/10528.md index ae9c2f1cf..d48170555 100644 --- a/changelog_unreleased/javascript/10528.md +++ b/changelog_unreleased/javascript/10528.md @@ -4,13 +4,6 @@ Prettier special-cases AMD `define` calls to avoid unexpected line breaks in the ```jsx -// Input -const someVariable = define( - "some string literal", - anotherVariable, - yetAnotherVariable -); - // Prettier stable const someVariable = define("some string literal", anotherVariable, yetAnotherVariable); diff --git a/changelog_unreleased/javascript/10666.md b/changelog_unreleased/javascript/10666.md index d47983aa7..d35e2fdf1 100644 --- a/changelog_unreleased/javascript/10666.md +++ b/changelog_unreleased/javascript/10666.md @@ -1,4 +1,4 @@ -#### Fix duplicated prettier-ignore comments (#10666 by @fisker) +#### Fix duplicated `prettier-ignore` comments (#10666 by @fisker) ```jsx diff --git a/changelog_unreleased/javascript/10693.md b/changelog_unreleased/javascript/10693.md index 562aad667..b82c3a9f1 100644 --- a/changelog_unreleased/javascript/10693.md +++ b/changelog_unreleased/javascript/10693.md @@ -1,13 +1,7 @@ -#### Improve formatting for do expression (#10693 by @sosukesuzuki) +#### Improve formatting for `do` expressions (#10693 by @sosukesuzuki) ```js -// Input -expect(do { - var bar = "foo"; - bar; -}).toBe("foo"); - // Prettier stable expect( do { diff --git a/changelog_unreleased/javascript/9672.md b/changelog_unreleased/javascript/9672.md index 27ee623d8..e23d509eb 100644 --- a/changelog_unreleased/javascript/9672.md +++ b/changelog_unreleased/javascript/9672.md @@ -1,9 +1,7 @@ -#### Improve comment format (#9672 by @fisker) - -When multiple comments on same line, the result became unstable. +#### Fix unstable multiple comments on the same line (#9672 by @fisker) -```jsx +```js // Input a; /*1*//*2*/ diff --git a/changelog_unreleased/javascript/9743.md b/changelog_unreleased/javascript/9743.md index 437d54ec8..00bee1081 100644 --- a/changelog_unreleased/javascript/9743.md +++ b/changelog_unreleased/javascript/9743.md @@ -1,5 +1,7 @@ #### Fix inconsistent language comment detection (#9743 by @fisker) +An `/* HTML */` comment should directly precede a template literal for the latter to be recognized as HTML-in-JS. Previously, the comment was erroneously recognized is some other locations. + ```jsx // Input diff --git a/changelog_unreleased/javascript/9992.md b/changelog_unreleased/javascript/9992.md index 58b7d9633..9c6713354 100644 --- a/changelog_unreleased/javascript/9992.md +++ b/changelog_unreleased/javascript/9992.md @@ -2,16 +2,6 @@ ```js -// Input -const currying = - (argument1) => - (argument2) => - (argument3) => - (argument4) => - (argument5) => - (argument6) => - foo; - // Prettier stable const currying = (argument1) => (argument2) => (argument3) => (argument4) => ( argument5