Getting Started

System Requirements

Installation

The fastest way to download Rome is to use npm or your preferred package manager. The CLI is also available as a standalone executable if you want to use Rome without installing Node.js.

Run the following commands in a directory with a package.json file to install Rome.

npm install --save-dev --save-exact rome
yarn add --dev --exact rome
pnpm add --save-dev --save-exact rome

Note: It is also possible to install Rome globally rather than locally. However, this is not recommended.

It’s highly recommended to not use range operators when installing Rome. Check the versioning page for more info.

You can now run Rome with:

npx rome 
yarn rome 
pnpm rome 

Configuration

We recommend creating a rome.json configuration file for each project. It eliminates the need to repeat the CLI options every time you run a command and ensures that Rome applies the same configuration in your editor. If you’re happy with Rome’s defaults, you don’t have to create the configuration.

To create the configuration, run the init command in the root folder of your project:

npx rome init
yarn rome init
pnpm rome init

After running the init command, you’ll now have a new rome.json file in your directory:

rome.json
{
  "$schema": "./node_modules/rome/configuration_schema.json",
  "organizeImports": {
    "enabled": false
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  }
}

The linter.enabled: true enables the linter and rules.recommended: true enables the recommended rules.

Formatting is enabled because the configuration doesn’t explicitly disable formatting with formatter.enabled: false.

Usage

You can lint any file or directory running:

npx rome check <files>
yarn rome check <files>
pnpm rome check <files>

or format your files and directories with:

npx rome format <files> --write
yarn rome format <files> --write
pnpm rome format <files> --write

Editor Setup

We recommend installing our editor integration to get the most out of Rome. The Rome editor integration allows you to:

VS Code

Install our official Rome VS Code extension from the Visual Studio Marketplace.

To make Rome the default formatter open a supported file (JavaScript or TypeScript) and:

Other Editors

We would love to support more editors, but we don’t have the capacity to implement and maintain multiple editor integrations at the moment. You can help us prioritize by voting for your favourite editor. If you’re interested in building an integration for Rome, please reach out, and we would be more than happy to support you.

If you are looking for editor support in a JetBrains IDE like WebStorm, then visit the relevant issue to upvote the ticket.

CI Setup

If you’re using Node.js, the recommended way to run Rome in CI is to use your favourite package manager. This ensures that your CI pipeline uses the same version of Rome as you do inside of the editor or when running local CLI commands.

If you are working on a project that isn’t using Node.js, then the best way to integrate Rome into your CI is to use the setup-rome GitHub Action or install the standalone executable.

Next Steps

Success! You’re now ready to use Rome. 🥳