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

Drop direct Prettier usage #777

Open
fregante opened this issue Jan 29, 2025 · 1 comment
Open

Drop direct Prettier usage #777

fregante opened this issue Jan 29, 2025 · 1 comment

Comments

@fregante
Copy link
Member

fregante commented Jan 29, 2025

Using prettier kinda makes sense here but most repos I've worked on use prettier everywhere, not just on JS files. See the latest issue:

I think that XO can be compatible with prettier without using it directly:

xo --prettier

Would become

xo --prettier && prettier

The flag would enable compatibility with prettier rather than run prettier.

In reality repos already have to run two commands since they have to run prettier on the remaining files anyway, but they risk running different prettier versions.

@spence-s also mentioned difficulty migrating the current config to flat due to prettier, if I understood that correctly

@spence-s
Copy link
Contributor

I typically use prettier, and I have jumped through a lot of hoops to get prettier working in the flat config. It is mostly working now.

I think I would support this design decision though for a couple of reasons.

  • prettier now has its own concept of overrides which will be extremely difficult to support in xo, we don't support this in the current or flat version
  • As you said, the code is difficult to support in general, but we have it migrated at this time.
  • prettier now supports much more than js and ts so I commonly run prettier on just css and json without xo anyway so this wouldn't be a big deal.
  • finally, the flat config still feels really slow sometimes (I am using it on most of my repos now), I am not sure what is at the root cause of that. I don't think prettier is helping and could be a culprit.

1 concern I have over dropping prettier formatting directly is that I am not sure that the vscode editor extension supports the work flow of using both prettier and xo without some changes. It might though, and I don't think the changes would be too hard if needed.

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

No branches or pull requests

2 participants