BiomeJS - A 35x faster alternative to Prettier for formatting and linting
Biome is a fast formatter for JavaScript, TypeScript, JSX, and JSON that scores almost 97% compatibility with Prettier. The goal is to save CI and developer time.
Why move to BiomeJS?
Although Prettier has been a reigning favorite among developers for JavaScript formatting and linting purposes, BiomeJS has gained traction due to its exceptional speed. It performs the same tasks in a fraction of the time that Prettier does. Being efficient and effective at the same time, BiomeJS is turning heads in the development community.
Let's look at an example of how to configure BiomeJS for your project. Here, the key comes down to compatibility.
First install BiomeJS:
npm i -D --save-exact @biomejs/biome
Then thankfully, transitioning from Prettier to BiomeJS is rather simple:
// biome.json
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"indentStyle": "space",
"lineWidth": 120
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingComma": "es5"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
We have similar rules and settings just like in your old Prettier config. Then you can install some plugins into your favorite IDE. Of course, if you want you can manually check file/files via CLI command:
npx @biomejs/biome lint ./src # just check
npx @biomejs/biome lint --apply ./src # check and apply changes
After applying BiomeJS you're free to remove a lot of dependencies like:
prettier
eslint
prettier-plugin-organize-imports
prettier-plugin-tailwindcss
@typescript-eslint/eslint-plugin
@typescript-eslint/parser
eslint-plugin-react
eslint-plugin-react-hooks
eslint-react-refresh
...
Now the dependency list is much smaller!
Conclusion
BiomeJS is a powerful tool that offers a faster alternative to Prettier. Saving time without compromising the quality of code formatting and linting, BiomeJS stands out as a robust solution for efficient coding. But if the speed is fine for your current project - then I don't see a big reason to change tools. While Prettier has its own merits because it's solid and old, give BiomeJS a try and you might be surprised!
Happy bioming!