Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to dprint 0.17.2 #5195

Merged
merged 1 commit into from
May 10, 2020
Merged

Update to dprint 0.17.2 #5195

merged 1 commit into from
May 10, 2020

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented May 10, 2020

I'll try to give these style updates in my PRs from now on.

Improvement: Binary Expression Operator Precedence

For example, given the following:

test && testttttttttttttttttttttttt || aaaaaaaaaaaaaaa && testttttttttttttttttttt;

It now formats like so:

test && testttttttttttttttttttttttt ||
    aaaaaaaaaaaaaaa && testttttttttttttttttttt;

Previously, && and || had the same precedence along with basically everything else.

Prettier formats like so and I've opened https://github.com/dprint/dprint/issues/200 for adding parens like this:

(test && testttttttttttttttttttttttt) ||
  (aaaaaaaaaaaaaaa && testttttttttttttttttttt);

Note, I deviated from prettier and gave division and multiplication the same precedence. It made sense to me that they should be equal precedence because they're essentially the same thing.

Other Improvements

  • JSX elements, JSX attributes, and decorators now use the same "multi-line" behaviour as elsewhere.
  • JSX text now wraps.

Performance

Overall, the performance has degraded by about 25% lately. I am planning on working on some dprint specific debugging tools to make it very fast, but right now I'm more focused on making sure it works well.

Future

  • I'm still working on the preferSingleLine config, which is currently false. The config is all wired up, but I've noticed how it formats when that's true still needs lots of work for certain edge cases.
  • I opened a preliminary work in progress PR in swc for parsing parameter decorators. Hopefully that can move forward fast.

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for the update : )

@ry ry merged commit e9318aa into denoland:master May 10, 2020
@dsherret dsherret deleted the update_dprint_0_17_2 branch May 10, 2020 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants