Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

feat(rome_js_formatter): TS Intersection & Union types #3162 #3206

Merged
merged 1 commit into from
Sep 13, 2022

Conversation

denbezrukov
Copy link
Contributor

Summary

Fix #3162 for TS Union.

Prettier: https://github.com/prettier/prettier/blob/cd3e530c2e51fb8296c0fb7738a9afdd3a3a4410/src/language-js/print/type-annotation.js#L123-L202

Test Plan

Current:
Average compatibility: 86.00
Compatible lines: 84.91

Main:
Average compatibility: 85.67
Compatible lines: 84.09

New test cases union_type.ts
cargo test --package rome_js_formatter

@denbezrukov denbezrukov requested a review from a team September 12, 2022 16:38
@netlify
Copy link

netlify bot commented Sep 12, 2022

Deploy Preview for docs-rometools ready!

Name Link
🔨 Latest commit 460af0d
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/631f95533b0e810009de4d3c
😎 Deploy Preview https://deploy-preview-3206--docs-rometools.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Awesome. I'll have some fun merging this with my comments refactor :D

@denbezrukov
Copy link
Contributor Author

denbezrukov commented Sep 12, 2022

Awesome. I'll have some fun merging this with my comments refactor :D

Oh, sorry.
We can wait your MR and after I can try to merge it after your refactor. Is it better?

BTW: I've found strange comments behaviour with union types.
Playground

@MichaReiser
Copy link
Contributor

Awesome. I'll have some fun merging this with my comments refactor :D

Oh, sorry. We can wait your MR and after I can try to merge it after your refactor. Is it better?

BTW: I've found strange comments behaviour with union types. Playground

Don't be. It helps me a big deal when working on matching the union and intersection type comments handling because I now only have too look into how comments are formatted and can assume that the rest works as expected.

Don't worry. I'll look into the comment placement. We soon have better tooling to place comments well.

@MichaReiser MichaReiser merged commit 158f55c into rome:main Sep 13, 2022
@MichaReiser MichaReiser added this to the 0.10.0 milestone Sep 13, 2022
@MichaReiser MichaReiser added the A-Formatter Area: formatter label Sep 13, 2022
@denbezrukov denbezrukov deleted the feature/ts-union branch September 13, 2022 07:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatter: TS Intersection & Union types
2 participants