Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration

Put an arity.toml at the root of your project to share formatting and linting settings between the CLI and language server. Every key is optional. This guide covers common setup tasks; the configuration reference lists all keys, defaults, and resolution rules.

Create a Project Config

Run this in a project that does not yet have an arity.toml:

arity init

The generated file contains commented settings. A small active configuration might look like this:

extend-exclude = ["vendor/", "*.gen.R"]

[format]
line-width = 100

[lint]
ignore = ["unused-binding"]

Commit the file so contributors use the same settings. Keys use kebab-case; unknown keys are errors. Add #:schema https://arity.cc/arity.schema.json at the top for completion and validation in editors that support TOML schema directives. See editor support for other ways to associate the schema.

Choose the Configuration Source

For each input file, Arity uses the nearest arity.toml, searching upward to the repository root. When there is no project config, ARITY_CONFIG can point to a fallback file. Discovery selects one file; it does not automatically merge project and user settings.

To choose a file explicitly or try the built-in defaults:

arity --config path/to/arity.toml format R/example.R
arity --no-config lint R/example.R

CLI options such as --line-width override the corresponding setting for one run. See discovery for fallback paths and language-server behavior.

Share Settings Between Projects

Use extend when a project should inherit another file:

extend = "../shared/arity.toml"

[format]
line-width = 100

The path is relative to the file declaring it. The project’s values override inherited values. Tables merge by key, while extend-exclude adds patterns to the inherited exclusions.

Exclude Files

Use extend-exclude to add gitignore-style patterns while retaining Arity’s built-in exclusions:

extend-exclude = ["vendor/", "generated/"]

These patterns apply to directory walks by both the formatter and linter. A file named explicitly is still processed; add --force-exclude when a runner passes filenames that should respect the exclusions:

arity format --force-exclude generated/example.R

Set exclude only when you want to replace the default list. For a local exception within a source file, use directives.

Adjust Formatting and Linting

Use [format] for layout settings and [lint] for rule selection. Start with the formatting and linting guides, then consult the reference for formatting options and lint settings.

Use extend-select to enable opt-in rules while preserving the defaults:

[lint]
extend-select = ["undesirable-function"]

If you also set select, Arity adds extend-select to that list instead. ignore takes precedence over both lists. When inheriting a config with extend, extend-select accumulates across the chain.

The dprint plugin has its own configuration in dprint.json; it does not load arity.toml.