-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
chore: use biome to format JSON and JavaScript files #8280
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
Conversation
|
7e5b975 to
bd71c57
Compare
bd71c57 to
6d35ba3
Compare
|
It would be fantastic if biome can support md, yml and Astro so we can get rid of prettier altogether :D |
6d35ba3 to
8a7e4db
Compare
It could, yes u.u Unfortunately, we're not there yet. |
8a7e4db to
c8d1892
Compare
bluwy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimming through the changes they look fine to me. Have one comment below about tabs in json. Other than that it looks great! We should also follow-up and remove the [ci] format commit so they formatting is enforced in CI.
|
I'm in favor of this! Could you add ad0d2b0 to |
|
Just a heads up that I also opened #8420, but we can merge either one first |
If you really want to be snazzy and fast for those files too, you could replace Prettier with dprint 😄 . And at that point you might as well replace Biome with dprint altogether, no? A couple of interesting dprint references: |
|
@JoshuaKGoldberg Might as well use dprint for js/ts too 😁 Edit:
I somehow missed this… |
|
Ha, my phrasing was rushed and odd. Edited for clarity. Thanks 😄 |
|
Hmm looks like dprint doesn’t have an official plugin for formatting yaml or Astro. |
It's possible to use prettier in dprint for that (https://github.com/dprint/dprint-plugin-prettier). It will run faster than prettier because it executes prettier on multiple threads. |
e318892 to
6a3ce6c
Compare
I wanted to do that, but should we wait for the PR to be merged? I thought that when we merge the PR, GitHub creates a new commit. |
| # New formatting using Biome | ||
| 07613b96bbe7a74179895c8cbe5f364133edd9ee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think we should only do this after merging. The commit hash will change
| import './server-shim.js'; | ||
| import { LitElementRenderer } from '@lit-labs/ssr/lib/lit-element-renderer.js'; | ||
| import * as parse5 from 'parse5'; | ||
| import './server-shim.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need the import './server-shim.js'; to be first as it's side-effectful and presumably affects how @lit-labs/ssr/lib/lit-element-renderer.js is loaded, so the order matters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They should honestly be in separate group if the order is important, any formatter would make this mistake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah putting a space between the imports would be fine by me too. I guess if biome wants to be more cautious about this automatically, plain import '...' ordering should be left as-is.
|
Will biome also be added to the astro sites? |
No, this is only for our own repo. |
|
Why is this closed? |
Since Biome can't format a fair amount of our files, it feels weird to have multiple formatters with different styles and configs |
It seems there isn't enough interest and I don't want to keep the PR open. If someone else wants to open a new one, they are welcome |
Changes
With this PR, I want to propose the usage of
biomefor format JSON and JS files instead of prettier.Also, it proposed to remove the
organize-imports-cliand usebiometo do that.Here's the benchmarks run on my machine.
Current
format:cicommand:Format + organize imports of
biome:biome+ prettier (we need to keep prettier to formatyml,astroandmdfiles):This comes to a price though, having another tool inside the code base. Although, I think this is worth the price:
organize-imports-cli, which was taking a lot of time to finish;[ci] formatis going to take way less time to apply the commit;Testing
The current CI should pass.
Docs
N/A