Announcing Rome Formatter
With our new formatter, we made sure to focus on ease of adoption. We know most users already use Prettier to format their code. Therefore, we decided to embrace Prettier’s styling decisions as much as possible. While this has been the goal, we can’t guarantee perfect Prettier compatibility. We plan on doing additional work in the future to reach Prettier compatibility, and to document any purposeful deviations from Prettier.
For each part of Rome that we build, we want to make sure it can stand on it’s own. There’s no benefit in making Rome do everything, if every piece ends up being worse than the alternatives.
For this reason, we took a critical look at how we could improve upon formatting with our unique architecture. One feature that largely stood out was IDE integration.
We wanted our formatter to be like any other tool in your IDE. One particular characteristic of IDEs is that they’re very good at error recovery. Even if you have a syntax error on line 5, the IDE still provides highlighting and code fixes on line 15. With existing formatters such as Prettier, this is not the case. One single syntax error can hold up formatting for the rest of the code.
We’re still refining our formatter’s error recovery, so we made it an opt-in feature for the first release. Feel free to try it out and give us some feedback. In the future we plan on having it on by default.
We plan on building upon this recoverable parser in the future to bring even more innovative features to your development workflow.
With a Docker container on a continuous integration workflow, this can be even longer. Nobody likes waiting for CI to finish. It disrupts your flow, wasting time and energy, not to mention running up your AWS or GCP bill.
As a quick example of Rome Formatter’s performance, we decided to compare it to Prettier, by formatting some large open source projects such as ESLint, Webpack, and TypeScript on an M1 Macbook Air with 8GB of RAM . We found that formatting with Rome is 9-12x faster than formatting with Prettier.
And of course, this is just the beginning. We’re going to expand the formatter to capture all the different languages we use in web development, such as CSS, HTML, JSON, etc. We also plan on announcing some new products in the near future. If you’re interested in joining our mission, we’re hiring. Stay tuned!
A quick cautionary note, we are not running a proper statistically rigorous setup like Criterion.rs. However, we believe that these numbers are an accurate representation of the performance you will experience. We plan on providing more rigorous benchmarks in the future and introducing performance regression testing. ↩︎