Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix unstable formatting of logical expressions (#7026)
- Loading branch information
Showing
6 changed files
with
113 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#### Fix unstable formatting of logical expressions ([#7026](https://github.com/prettier/prettier/pull/7026) by [@thorn0](https://github.com/thorn0)) | ||
|
||
<!-- prettier-ignore --> | ||
```jsx | ||
// Input | ||
const averredBathersBoxroomBuggyNurl = | ||
bifornCringerMoshedPerplexSawder === 1 || | ||
(askTrovenaBeenaDependsRowans === 2 || glimseGlyphsHazardNoopsTieTie === 3); | ||
|
||
// Prettier stable (first output) | ||
const averredBathersBoxroomBuggyNurl = | ||
bifornCringerMoshedPerplexSawder === 1 || | ||
askTrovenaBeenaDependsRowans === 2 || glimseGlyphsHazardNoopsTieTie === 3; | ||
|
||
// Prettier stable (second output) | ||
const averredBathersBoxroomBuggyNurl = | ||
bifornCringerMoshedPerplexSawder === 1 || | ||
askTrovenaBeenaDependsRowans === 2 || | ||
glimseGlyphsHazardNoopsTieTie === 3; | ||
|
||
// Prettier master (first output) | ||
const averredBathersBoxroomBuggyNurl = | ||
bifornCringerMoshedPerplexSawder === 1 || | ||
askTrovenaBeenaDependsRowans === 2 || | ||
glimseGlyphsHazardNoopsTieTie === 3; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/logical_expressions/__snapshots__/jsfmt.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const radioSelectedAttr = | ||
(isAnyValueSelected && | ||
node.getAttribute(radioAttr.toLowerCase()) === radioValue) || | ||
((!isAnyValueSelected && values[a].default === true) || a === 0); |