Configuration

The configuration file is considered optional, Rome has good defaults. Use the configuration file to change those defaults.

The Rome configuration file is named rome.json and should be placed in the root directory of your project. The root directory is usually the directory containing your project’s package.json.

Here’s an example:

rome.json
{
  "formatter": {
    "enabled": true,
    "indentStyle": "tab",
    "lineWidth": 120
  },
  "linter": {
    "enabled": false
  }
}

This configuration file enables the formatter and sets the preferred indent style and width. The linter is disabled.

$schema

Allows to pass a path to a JSON schema file.

Since version 11.0.0, a JSON schema file for the rome.json is published.

You can specify a relative path to the schema of the rome npm package if rome is installed in the node_modules folder:

rome.json
{
  "$schema": "./node_modules/rome/configuration_schema.json"
}

files

files.maxSize

The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason.

Default: 1024*1024 (1MB)

files.ignore

A list of Unix shell style patterns. Rome ignores files and folders that match these patterns.

rome.json
{
  "files": {
    "ignore": ["scripts/*.js"]
  }
}

linter

linter.enabled

Enables Rome’s linter

Default: true

linter.ignore

An array of Unix shell style patterns.

rome.json
{
  "linter": {
    "ignore": ["scripts/*.js"]
  }
}

linter.rules.recommended

Enables the recommended rules for all groups.

Default: true

linter.rules.all

Enable or disable all rules for all groups.

If recommended and all are both true, Rome will emit a diagnostic and fallback to its defaults.

rome.json
{
  "linter": {
    "enabled": true,
    "rules": {
      "all": true
    }
  }
}

It’s also possible to combine this flag to enable/disable different rule groups:

rome.json
{
  "linter": {
    "enabled": true,
    "rules": {
      "all": true,
      "style": {
        "all": false
      },
      "complexity": {
        "all": false
      }
    }
  }
}

In the previous example, Rome will enable all rules, exception for rules that belong to the style and complexity groups.

linter.rules.[group]

Options that influence the rules of a single group. Rome supports the following groups:

linter.rules.[group].recommended

Enables the recommended rules for a single group.

Example:

rome.json
{
  "linter": {
    "enabled": true,
    "rules": {
      "nursery": {
        "recommended": true
      }
    }
  }
}

linter.rules.[group].all

Enables all rules for a single group.

Example:

rome.json
{
  "linter": {
    "enabled": true,
    "rules": {
      "nursery": {
        "all": true
      }
    }
  }
}

formatter

These options apply to all languages. There are additional language-specific formatting options below.

formatter.enabled

Enables Rome’s formatter

Default: true

formatter.ignore

An array of Unix shell style patterns.

rome.json
{
  "formatter": {
    "ignore": ["scripts/*.js"]
  }
}

formatter.formatWithErrors

Allows to format a document that has syntax errors.

rome.json
{
  "formatter": {
    "formatWithErrors": true
  }
}

Default: false

formatter.indentStyle

The style of the indentation. It can be "tab" or "space".

Default: tab

Rome’s default is "tab".

formatter.indentSize

How big the indentation should be.

Default: 2

formatter.lineWidth

How many characters can be written on a single line.

Default: 80

organizeImports

organizeImports.enabled (experimental)

Enables Rome’s sort imports.

organizeImports.ignore

A list of Unix shell style patterns. Rome ignores files and folders that match these patterns.

rome.json
{
  "organizeImports": {
    "enabled": true,
    "ignore": ["scripts/*.js"]
  }
}

Default: false

javascript

These options apply only to JavaScript (and TypeScript) files.

javascript.formatter.quoteStyle

The type of quote used when representing string literals. It can be single or double.

Default: double

javascript.formatter.quoteProperties

When properties inside objects should be quoted. It can be asNeeded or preserve.

Default: asNeeded

javascript.formatter.trailingComma

Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Possible values:

Default: all

javascript.formatter.semicolons

It configures where the formatter prints semicolons:

Default: always

Example:

rome.json
{
  "javascript": {
    "formatter": {
      "semicolons": "asNeeded"
    }
  }
}

javascript.globals

A list of global names that Rome should ignore (analyzer, linter, etc.)

rome.json
{
  "javascript": {
    "globals": ["$", "_", "externalVariable"]
  }
}