Skip to main content

Announcing Rome Formatter

Rome Team

We began a full rewrite of Rome in Rust last year, and we’re excited to announce our first release as a part of this effort with the Rome Formatter, a new formatter for JavaScript and TypeScript. It perfectly expresses our goals of excellent performance, ease-of-use, and first-class IDE integration.

Prettier revolutionized the JavaScript ecosystem by normalizing standards and removing formatting discussions. Teams can more effectively review code, developers don’t need to address formatting nits, and the barrier to onboarding into a codebase is reduced.

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.

You can try out our formatter by installing our Visual Studio Code extension. We also have a CLI in an early alpha state that you can learn about in our getting started guide.

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 wanted to change that. Therefore, it was really important to us that the formatter work with incorrect code. We put a lot of work into building an error tolerant JavaScript/TypeScript parser that could quickly recover from errors, and then extending our formatter to work on this broken code. That way, no matter how many syntax errors in your code, our formatter could still make it look better.

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.

Another significant advantage that stands out over other JavaScript-based developer tools is performance. While there’s an inherent speed increase from switching to a lower level language like Rust, we’ve focused on performance every step of the way. It’s essential that we have a lean core to base future functionality.

It’s very common for developers to have a git hook or continuous integration workflow that verifies that their repository is correctly formatted. For existing JavaScript formatters such as Prettier, this can take over 30 seconds on a top computer!

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 [1]. 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!

Read more

Rome Formatter and Rust Update

Rome Team

With our last update, we announced a complete rewrite in Rust. As many can attest, rewriting can be a rather long, difficult process. Our team has been working extremely hard on this undertaking and has made great progress. We’ll write a more thorough post about our experience with Rust and rewriting in the future, but here’s a short summary of our efforts.

We started our Rust rewrite by forking the excellent RSLint parser. A huge thanks the entire RSLint team for their work, especially to Riccardo D’Ambrosio for helping us with this process. We chose the RSLint parser as we wanted a more modern, editor-focused architecture inspired by projects such as Roslyn, rust-analyzer, and TypeScript. The parser produces a concrete syntax tree (CST) that represents the original code completely, whitespace, comments and all. While a compiler can throw away semantically irrelevant info such as comments, an editor must preserve these bits of trivia.

However, this CST is not the easiest to navigate, which required an abstract syntax tree (AST) facade on top of this CST that allowed for a cleaner interface. This parsing infrastructure will be the foundation for Rome’s focus on first class editor support. By representing the code in full fidelity, we can offer a code manipulation API for features like refactoring, code fixes, and many others.

We’re also very thrilled to announce the first showcase of this parser in our Rome Formatter: A blazing fast JavaScript and TypeScript formatter. Formatters are a perfect showcase of our parsing architecture, as they too need to preserve trivia. But why create a new formatter? When we began our Rust rewrite, we fell in love with rustfmt, Rust’s own formatter. It formatted code instantly, unlike JavaScript formatters which could often take quite a few seconds on larger files. We wanted that same experience in JavaScript. Rome Formatter, like all our tools, will have the editor experience as the core. We plan on shipping a VSCode extension in the next few months that will allow for one-click adoption and usage.

We’ve also expanded our team, hiring four new members this past six months, bringing us to a total of eight team members. We’re really excited to welcome Daniel, Léo-Paul, and Nicholas onto the team.

Lastly, we shipped out swag to everybody who donated to our fundraising campaign. We’ve received an amazing response!

We have a lot more in the pipeline. Stay tuned for future blog posts, other product announcements and some exciting updates.

Read more

Rome will be written in Rust 🦀

Rome started off written in JavaScript because that is the language of choice for our team and it made it easier for others in the community to join as contributors. We love JavaScript and TypeScript (and HTML and CSS) at Rome, and we want to build the very best tooling possible for these languages. For a number of reasons, we’ve decided that Rust will provide a better foundation for this tooling.

We are also taking the opportunity to explore fundamental shifts in the architecture of Rome. These changes give us more flexibility and will allow us to build tooling JavaScript and the web has not had before.

Read more

Announcing Rome Tools, Inc.

The JavaScript ecosystem has undergone rapid evolution in the last decade. I started Babel in 2014 not knowing what I was getting myself into, and have been offered a unique perspective watching it grow. Since then we’ve had an explosion in developer tooling and seen the web take an even bigger role in application development.

Our tools haven’t caught up with this evolution though. They struggle to work together, upgrades are painful, configuration is convoluted, errors are confusing, and everything is slow. We don’t need an incremental improvement, we need to fundamentally change how this tooling is built and used.

Rome is an end-to-end development toolchain. We consolidate dozens of separate tools into one, with support for JavaScript, TypeScript, HTML, and CSS. Rome can install your dependencies, check your code for errors, run your tests, bundle your code, and more, all via a single CLI. Rome is not a collection of tools, it has been written from scratch.

Today I’m excited to announce a few changes to the project and the formation of the Rome company.

Read more

The Road to Rome: Fundraising and Project Goals

I’m Sebastian McKenzie, the creator of Babel and Yarn. These tools have both inspired me to create Rome, a new project that aims to simplify and improve JavaScript and web development.

Rome consolidates dozens of separate tools into one. Rome can install your dependencies, check your code for errors, run your tests, bundle your code, and more, all via a single CLI. Rome will be able to replace Babel, ESLint, Prettier, Yarn, and webpack. Learn more.

It’s been three months since we announced our initial beta release. Since then, we’ve received a tremendous amount of enthusiasm from the community. As that enthusiasm has grown, it’s become clear that Rome will require a full-time developer to be successful and deliver on our ambitious goals and release a stable v1.0.

I need your help to make it a reality.

Read more

Introducing Rome

We’re excited to announce the first beta release and general availability of the Rome linter for JavaScript and TypeScript.

This is the beginning of an entire suite of tools. Rome is not only linter, but also a compiler, bundler, test runner, and more, for JavaScript, TypeScript, HTML, JSON, Markdown, and CSS. We aim to unify the entire frontend development toolchain.

Read more