Meet Rome from the creators of Babel - compiler, builder, linter, tests in one bottle





Almost two weeks ago, a blog post about Rome came out .



Rome is a whole set of tools - linter, compiler, builder, test runner and more. It targets JS, TS, HTML, JSON, Markdown, CSS. The project is trying to unify the set of tools needed for front-end development.



Rome is monolithic and includes all of the traditional front-end ecosystem tools. The development team calls it the toolchain. The important point is that this is not an attempt to merge an existing set of tools, but to develop an entirely new set of tools. All this should be in one package and a single codebase.



Rome is being developed as a replacement for Babel, ESLint, Webpack, Prettier, Jest and others.



Let's see where this leads, to be honest I am satisfied with some competition and a "non-monolithic" approach in development tools. Yes, for a beginner, the entrance is not obvious, there are too many tools that are mostly interchangeable. Perhaps in this nuance, Rome will slightly lower the entry threshold.



Current state







Rome is in beta and is already doing some of its responsibilities. For example, the linter already supports 100 rules, including those commonly used when using Typescript and React. The full list of rules can be found here. The



open source of the project began at the beginning of the year and the project already has 70 contributors and over 600 commits. In general, the project is developing and so far no attenuation is visible.



A bit of history



In 2014, 6to5 (now called Babel) was created. This is a JavaScript transpiler that compiled new ES6 code into ES5. At that time, the project did not set any goals, but with the growth of popularity, the development had to be adjusted.



6to5 was renamed Babel and the new goal was to become a common framework for JavaScript static transformations. This meant a plugin system and support for new features for future JavaScript standards and even "proposals".



The development team thought to go even further. Babel should be under the hood of minifiers, linters, formatters, syntax highlighting, type checkers, compilation tools, and so on.



In 2016, the creator of Babel left the project. Over time, it became clear that the approach of providing a broad API (literally all internals) was too difficult to maintain. To support the above toolkit, literally everything would have to be rewritten. The architecture of the project is related to the decisions that the author made back in 2014, only studying how AST parsers and compilers work. The changes would affect most of the API without backward compatibility.



JavaScript tool developers spend an enormous amount of time processing source code. Babel, ESlint, Webpack, are all partially doing the same thing.



Linters in the JavaScript ecosystem are like compilers. Both take the source code as input, both process it and output the code and errors (if any). Only the received code is different. In the case of the linter, this is formatted source code with patches.



The stronger your compilation infrastructure, the stronger the linter. The same applies to other tools that process code in one way or another. We can build more powerful tools using a common framework that is easy to adapt.



Rome is the spiritual successor to Babel. I learned my lessons and set clear goals. Instead of providing an overly voluminous public API for other tools, we collect them all in one place. I'm thrilled to try something new that JavaScript and the web ecosystem have never seen before.


- Sebastian McKenzie



Using



Rome can be installed using Yarn or NPM:



yarn add rome


npm install rome


Project creation



In order for Rome to find your files, it needs a configuration. To automatically create a project, you can use:



rome init


This command will create a .config directory and place rome.rjson there , with the project configuration.



If you have an existing project, you can automatically apply formatting and fixes right away:



rome init --apply


RJSON is a JSON extension that adds some features. For example comments in JSON.


You can start the linter with



rome check


Linting



Rome is designed to provide as much information as possible to correct errors. The project has a kind of credo:



Rich UI (result in the console): Well-formatted information, syntax highlighting, links, lists, and more.



Fixes: Rome can fix a lot of bugs (like linters) and apply them automatically. If there are multiple solutions, then the tool gives you a choice.



Review process: The CLI is interactively rich and allows you to make decisions on fixes and go over all errors right in the console.



Editors: Rome integrates with editors, which allows you to do formatting for save, highlighting errors, etc.



Preservation: Rome caches the original files before making changes. Usingrome recover , you can roll back the fixes.







Instead of a conclusion



While this tool is still in active development, it can already be tried somehow. The main thing is that it doesn't turn out like this:







Off documentation



All Articles