-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Bun implementing a Formatter and Linter #2246
Comments
now, there are other priorities but thanks for this feature request |
The I want a cli tool that I can use to replace Having a lint tool would be a huge boon for local development. |
This would be great, ➕1 |
Bun should provide a formatter. I know its not priority, but it should have. The only thing we should consider when implementing it is to make it opnionated and universal, just like I think everyone can agree that this was a right decision for golang, no more debates on where spaces or tabs should be used. We just run |
Looking for same, found this request. Since bun is trying to solve all issues in js ecosystem this will a great addon, as most of recent languages are providing same kind of tooling to make dev life easier. |
I highly recommend to use: https://biomejs.dev/ . It based on rust 💯 and the installation via bunx is available. |
For users who didn't know, that is basically the rebrand of Rome as mentioned in their blog post: https://biomejs.dev/blog/annoucing-biome/
they seem to have very similar goals as Bun 😆 |
This is just another Prettier and ESLint. If I'm going to use this, I should just use Prettier and ESLint. All I need is the official internal tools of Bun. |
Formatter shouldn't be opinionated because it's not a new language like go. It will prevent many teams from switching. Allow lots of customization so it works with any existing code so people can use bun instead of external tool. |
I completely disagree what you are saying. BiomeJS is super fast and built outside of the JS land, which makes it super fast and more prone to be implemented by Bun. And creating a formatter and linter is a project of its own, there's not way bun will have funds and time to do it by themselves, adopting a open source project is the only solution.
But bun is a new tech, teams will have to adopt it manually anyways... |
But javascript isn't a new tech. Bun is a replacement for node.js. Teams won't change their runtime if they are forced to change their style for existing code. |
They will not be forced, ONLY if they also want to change their internal linting/style system to a standardized one by removing their prettier/eslint/... to bun, then yes. |
Or can make configurable so teams can decide on their own format and still benefit from bun tools. Benefit is standardization within a repo with the tool formatting the code according to settings for that repo. Bun developers don't need to tell you exactly how your code should look only that it follows the settings you chose. |
Just tried Biome rn. I think it is not required to reinvent it. |
I'm now using deno's formatter ( |
@borisdiakur I am also interested to use deno's formatter and linter for my bun project, could you please provide a tip on how do I do it? Like, what do I need to install and configure to get it working? thank you. |
i think you just need deno, nothing more, nothing less |
This comment was marked as off-topic.
This comment was marked as off-topic.
Yep, and the VS Code extension, settings, and config to make it behave the way would want, so you wouldn't have to install and configure eslint, stylistic, prettier, biome, and whatnot. See @alertbox/docsify-footer for a variant of minimal setup. Ideally, we'd be able to just do |
This comment was marked as off-topic.
This comment was marked as off-topic.
Hmm... No i discarded Deno Linter and Deno formatter, because I use Astro now and they neither lint nor format .astro files. Might go back to prettier and eslint. Maybe it will be useful for nextjs projects as its just standard tsx, not specific file like .astro. Also, I wanted to say that I've changed my mind, it is good for Bun project to NOT implement a formatter or linter, because I'm sure it might harm the project, the scope of project is already too wide (transpiler, unit test, bundler, etc). So i want them to focus on what's on the table, also more windows and nodejs compatibility. |
I build a few in-company cli tooling with deno and love the experience of having an opinionated way to do everything all the way to formatting and linting with the runtime. I certainly respect people loving their eslint and prettier setup and I sure setup those things for many years. But for me it's just another thing that is fine out of the box. I don't care if I use airbnb or google for linting. I just need a consistent default way and have less config files and be done with it. I'm suspecting lots of people are in the same situation so I'm all for an integrated experience. And if you still want a .prettierrc then go nuts. 😄👍 |
This comment was marked as off-topic.
This comment was marked as off-topic.
I also use
But yeah, it would be nice if I could run |
It would appear the biome website was refreshed and now only mention Formatting and Linting, but no test/bundling/transpiling. Seems like a more reduced scope compared to the original vision for Rome, which bun basically has delivered all other areas of in the meantime. Using biome and bun together is such a bliss compared to what i had before. Bun might be able to outdo biome on performance, but anyone moving from eslint/prettier to biome will already be blown away by the perf, so might be a hard sell. |
@birkskyum Hmm, nice, they even specify how to use it with helix (the only editor they mention there directly, lol) |
Seems like under the hood deno fmt is using https://dprint.dev/ |
This comment was marked as off-topic.
This comment was marked as off-topic.
There is also oxlint. |
I see the ecosystem evolving to something like:
So I don't think this is needed in Bun. |
I don't understand the excitement for biome yet... but I tried to integrate it into helix with the official manual, tried to install globally with both npm and bun, but somehow formatting doesn't work right now. But will keep an open eye for it. It is surprisingly popular. update: |
@janos-r I think Rome was blocked for a while. What Seb tried to create (a company around the toolchain so he could pay fulltime devs) was a worthy endeavour, but the market couldn't support that and along with their switch from JS to Rust the project got stuck and distracted for while. But since Rome became Biome it's found a lot of new energy. Linting for CSS is coming soon (which can replace Stylelint in a lot of workflows), and they're working on improving built-in type analysis to (eventually, someday, down the road) replace Typescript too (probably around the same time we get native types in ECMAscript). In maybe 5-7 years it should all slot into place nicely. I think the main reason to keep these things separate (in addition to a linter being a lot of work) is that while Bun is strongly tied to the JS ecosystem, a formatter/linter like Biome is more fundamentally language agnostic. |
I also think that it is not worth implementing linter/formatter in Bun, but officially recommend something like biome or alternatives Unnecessary work that will be nailed to the Bun |
js: eslint, prettier, oxlint, biome, standard js, jshint, sonarts meanwhile go: go fmt |
Don't forget |
and dprint xd |
@dhoulb Biome website says: Biome is a fast formatter for JavaScript, TypeScript, JSX, TSX and JSON that scores 97% compatibility with Prettier, Even if CSS is added to Biome, to me that does look a lot like the JS/Web ecosystem. I don't know if the ambition for Biome is to go beyond that though, but it looks like a CSS parser is part of the Bun roadmap too, so the overlap in scope appear quite large at least for now. Not fully convinced yet that one is more fundamentally language agnostic than the other. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Damn! Html was the last thing I still used prettier for. Now for formatting I will be all on deno (it is so much faster). For TS biome, and for svelte, the sveltserver lsp already defaults formatting to prettier under the hood, so maybe I will tweak helix to also use deno to format svelte... |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I did see the $ bun build fmt.js --no-bundle | bun -e 'Bun.write(Bun.file("fmt.js"), await Bun.file("/dev/stdin").text())' comment, but... that looks like some unreadable hack. That is nowhere near some official bun format support. Not to mention that there were official comments above saying that bun is not in the business of formatting stuff and people should use biome or deno for formatting. Nothing wrong with that. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Although I don't have experience with real world enterprise projects, a configuration file like bun.config.ts could potentially allow you to specify the formatter you want to use. For example:
While this approach will lead to a heavily nested file, it could resolve issues related to portability and the reduction of multiple configuration files in the project root. This structure could also enable importing settings from other files or repositories, making the configuration both cleaner and more portable. Additionally, it offers the customisability some users in the comments seemed to want, while still allowing Bun to promote a standardised style for developers who prefer to fully commit to the Bun ecosystem. |
While reading this thread, I noticed that some commenters mentioned Biome is still in early stage. This is no longer the case, it improved a lot in the latest few releases. It's already production-ready (which can't be said for Bun yet). |
i think oxc's eslint-compatible (albeit not fully yet) linter is promising. i prefer that over biome or bun creating a new linter. they took the same path bun took to node compatibility. |
They can also port OXC's Linter and Formatter just like lightningcss |
can you even develop rules for oxc or deno's linter? if no, they will never compete with eslint unfortunately |
This comment was marked as off-topic.
This comment was marked as off-topic.
what i meant is like eslint-plugin-unicorn where you can develop custom rules locally or publish them to npm |
This comment was marked as off-topic.
This comment was marked as off-topic.
Unfortunately, I noticed, its not working properly with emoji present in my code, it replaces them with \uD83D etc |
This comment was marked as off-topic.
This comment was marked as off-topic.
@huseeiin, Biome and OXC support more rules, e.g. many from the unicorn plugin and other sources. I guess if the rules are useful and well-implemented, then they accept it upstream, so separate plugin support is not needed. The Biome team is also working on 3rd party plugin support, based on GritQL, but I would recommend submitting the rules upstream, so it benefits everyone. |
It’s already 2024, and the JavaScript ecosystem still faces a new framework, library, linter, formatter, or bundler every six months. Hasn’t either Bun or Node tried to unify this yet? My solution: Then, I run: bun run lint
$ deno fmt
Checked 9 files Solved my problem ~ |
What is the problem this feature would solve?
instead of installing eslint or prettier (or even rome) used for linting and formatting purposes why not implement it
What is the feature you are proposing to solve the problem?
to have a way more performant dev exp. and even on the ci
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: