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.

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)

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 categories.

Default: true

linter.rules.[category]

Options that influence the rules of a single category. Rome supports the following categories:

- `Accessibility`: Rules focused on preventing accessibility problems. - `Complexity`: Rules that focus on inspecting complex code that could be simplified. - `Correctness`: Rules that detect incorrect or useless code. - `Security`: Rules that detect potential security flaws. - `Style`: Rules enforcing a consistent way of writing your code. - `Nursery`: New rules that are still under development. Nursery rules require explicit opt-in via configuration because they may still have bugs or performance problems. Nursery rules get promoted to other groups once they become stable or may be removed. Rules that belong to this group are not subject to semantic version.

linter.rules.[category].recommended

Enables the recommended rules for a single category.

Example:

rome.json
{
  "linter": {
    "enabled": true,
    "rules": {
      "nursery": {
        "recommended": 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.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.

formatter.lineWidth

How many characters can be written on a single line.

Default: 80

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