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

Remove hacks for single-element unions/intersections #10457

Merged
merged 2 commits into from Mar 3, 2021

Conversation

thorn0
Copy link
Member

@thorn0 thorn0 commented Mar 2, 2021

Description

Thanks to babel/babel#12758 now we can remove tricky workarounds for single-element unions and intersections.

Checklist

  • I’ve added tests to confirm my change works.
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@thorn0 thorn0 changed the title Remove hacks for degenerate unions/intersection Remove hacks for degenerate unions/intersections Mar 2, 2021
@thorn0 thorn0 linked an issue Mar 2, 2021 that may be closed by this pull request
@thorn0 thorn0 changed the title Remove hacks for degenerate unions/intersections Remove hacks for single-element unions/intersections Mar 3, 2021
@@ -980,7 +964,6 @@ module.exports = {
handleEndOfLineComment,
handleRemainingComment,
isTypeCastComment,
getGapRegex,
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I believe this only used in js, should we remove it from comment attach?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather keep it. It's a reasonable extension point. The default regex (/^[\s(]*$/) is JS-specific. It might work well for languages that use parens in a way similar to how JS uses them, but it's also possible that other languages might need to override this.

@thorn0 thorn0 merged commit 37aa31e into prettier:main Mar 3, 2021
@thorn0 thorn0 deleted the remove-union-hacks branch March 3, 2021 23:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments in typescript type unions move to incorrect place
2 participants