Type object
File match air.toml .air.toml
Schema URL https://catalog.lintel.tools/schemas/schemastore/air/latest.json
Source https://github.com/posit-dev/air/releases/latest/download/air.schema.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Configuration for Air

Properties

format FormatTomlOptions | null

Definitions

FormatTomlOptions object

Options to configure code formatting.

default-exclude boolean | null

Air automatically excludes a default set of folders and files. If this option is set to false, these files will be formatted as well.

The default set of excluded patterns are:

  • .git/
  • renv/
  • revdep/
  • cpp11.R
  • RcppExports.R
  • extendr-wrappers.R
  • import-standalone-*.R
default-table boolean | null

Air automatically formats a default set of calls as tables. You can disable these defaults by setting this option to false. The default set currently includes:

  • tribble() from tibble
  • fcase() from data.table
exclude array | null

By default, Air will refuse to format files matched by patterns listed in default-exclude. Use this option to supply an additional list of exclude patterns.

Exclude patterns are modeled after what you can provide in a .gitignore, and are resolved relative to the parent directory that your air.toml is contained within. For example, if your air.toml was located at root/air.toml, then:

  • file.R excludes a file named file.R located anywhere below root/. This is equivalent to **/file.R.

  • folder/ excludes a directory named folder (and all of its children) located anywhere below root/. You can also just use folder, but this would technically also match a file named folder, so the trailing slash is preferred when targeting directories. This is equivalent to **/folder/.

  • /file.R excludes a file named file.R located at root/file.R.

  • /folder/ excludes a directory named folder (and all of its children) located at root/folder/.

  • file-*.R excludes R files named like file-this.R and file-that.R located anywhere below root/.

  • folder/*.R excludes all R files located at root/folder/. Note that R files in directories under folder/ are not excluded in this case (such as root/folder/subfolder/file.R).

  • folder/**/*.R excludes all R files located anywhere below root/folder/.

  • **/folder/*.R excludes all R files located directly inside a folder/ directory, where the folder/ directory itself can /// appear anywhere.

See the full .gitignore documentation for all of the patterns you can provide.

indent-style IndentStyle | null

indent-style = "space" (default):

fn <- function() {
  # Spaces indent `cat()`
  cat("Hello")
}

indent-style = "tab":

fn <- function() {
  # A tab `\t` indents `cat()`
  cat("Hello")
}

Air defaults to spaces due to the overwhelming amount of existing R code written in this style, but consider using tabs for new projects to improve accessibility.

See indent-width to configure the number of spaces per indentation and the tab width.

indent-width IndentWidth | null

The value must be greater than or equal to 1 and less than or equal to 24. The default value is 2.

Used by the formatter to determine the visual width of a tab.

This option changes the number of spaces the formatter inserts when using indent-style = "space". It also represents the width of a tab when indent-style = "tab" for the purposes of computing the line-width.

line-ending LineEnding | null
  • auto: The newline style is detected automatically on a file per file basis. Files with mixed line endings will be converted to the first detected line ending. Defaults to \n for files that contain no line endings.

  • lf: Line endings will be converted to \n. The default line ending on Unix.

  • crlf: Line endings will be converted to \r\n. The default line ending on Windows.

  • native: Line endings will be converted to \n on Unix and \r\n on Windows.

line-width LineWidth | null

The value must be greater than or equal to 1 and less than or equal to 320.

While the formatter will attempt to format lines such that they remain within the line-width, it isn't a hard upper bound, and formatted lines may exceed the line-width.

persistent-line-breaks boolean | null

Air respects a small set of persistent line breaks as an indication that certain function calls or function signatures should be left expanded. If this option is set to false, persistent line breaks are ignored.

It may be preferable to ignore persistent line breaks if you prefer that line-width should be the only value that influences line breaks.

skip Skip | null

Air typically formats every function call it comes across. To skip formatting of a single one-off function call, you can use a # fmt: skip comment. However, if you know of particular functions that you use a lot that are part of a custom domain specific language that doesn't follow conventional formatting rules, you can entirely opt out of formatting for those functions by providing them here.

For example, using skip = ["graph_from_literal"] would automatically skip formatting of:

igraph::graph_from_literal(Alice +--+ Bob)
table Table | null

Some function calls are meant to be formatted as tables, rather than being formatted in a flat or expanded layout. For a single one-off function call, you can use a # fmt: table comment to request a table layout. For function calls that you use a lot, use this setting to add them to a list of function calls that are automatically formatted as tables without requiring a # fmt: table comment.

For example, using table = ["my_table"] would automatically format calls to my_table() in a table layout.

See default-table for the list of function calls that are automatically formatted as tables by default.

IndentStyle string | string
IndentWidth integer
LineEnding string | string | string | string
LineWidth integer
Skip string[]
SortedStrings string[]
Table string[]