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

fix(formatter/member-chain): regex formatting #474

Conversation

victor-teles
Copy link
Contributor

@victor-teles victor-teles commented Oct 2, 2023

Summary

This PR fixes #300

About the resolution

After some research in prettier repo, I discovered that regex expressions should only be considered simple if they have a length less than or equal to 5

Prettier ref: https://github.com/prettier/prettier/blob/d4d4b185e0ddc3e0dd839b873e2ee7fe8131b684/src/language-js/utils/index.js#L761C1-L761C1

Test Plan

  • Validate snapshot 😄
  • Added some regex cases

@victor-teles victor-teles requested review from ematipico, Conaclos and a team October 2, 2023 22:52
@github-actions github-actions bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Oct 2, 2023
@victor-teles victor-teles changed the title fix(formatter/member-chain): do not consider regex as simple fix(formatter/member-chain): regex formatting Oct 2, 2023
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Looks good to me, just left a minor comment. Feel free to merge the PR once addressed.

Copy link
Member

@Conaclos Conaclos left a comment

Choose a reason for hiding this comment

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

After some research in prettier repo, I discovered that regex expressions should only be considered simple if they have a length less than or equal to 5

:o this seems so strange as behavior!

Good work, everything looks great :)

@ematipico
Copy link
Member

After some research in prettier repo, I discovered that regex expressions should only be considered simple if they have a length less than or equal to 5

:o this seems so strange as behavior!

That's prettier for you :)

@victor-teles victor-teles merged commit b2ec1ad into biomejs:main Oct 3, 2023
12 checks passed
@victor-teles victor-teles deleted the fix/incorrect-function-chain-formatting branch October 3, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Incorrect formatting in function chain
4 participants