Configuration

Reettier reads its settings from a reettier.jsonc config file in your project root. The .jsonc extension means the file supports JSON comments (// and /* */), so each option can carry inline documentation.

Generate a config

Run --init to write a fully commented reettier.jsonc into the current directory, then edit it to suit your project:

reettier --init

Options

OptionTypeDefaultDescription
skipDirsstring[]["node_modules", "vendor", "vendors", "dist", "static", "templates"]Directory names to skip when formatting. Any folder matching one of these names is skipped, regardless of where it sits in the project.
skipFilesstring[][]Glob patterns for individual files to skip (e.g. "generator/templates/**/*.ts"). Matched against file paths relative to the project root.
skipExtensionsstring[]["min.js"]Compound extensions to always skip, regardless of extensions. A file ending in .min.js is skipped even when js is in extensions.
extensionsstring[]["ree", "ts", "js", "css"]File extensions to format. Only files with these extensions are picked up during recursive walks or glob matching.
skipDotDirsbooleantrueSkip directories whose name starts with a dot (e.g. .git, .next, .cache, .svelte-kit).
fullbooleanfalseWhen enabled, perform complete AST reprint formatting (like the legacy reefmt formatter). By default, Reettier is an indenter that preserves your line breaks; with full: true, it reformats the entire file based on the AST, collapsing and reflowing code.
wrapWidthnumber180Maximum line width before elements are broken onto multiple lines. Controls when inline elements are folded and when long tag lines are split. Only applies in --full mode.
collapseSoftWidthnumber100"Soft" wrap width. Any collapsible structure (call args, array/object/type members, imports) whose inline form fits within this width stays on one line regardless of the count caps - short calls with many short args collapse instead of exploding one-per-line. Above this width the count caps apply and wrapWidth is the hard ceiling. Set to 0 to disable. Only applies in --full mode.
collapseSingleStatementBlocksbooleantrueWhen enabled, single-statement blocks (if, for, while, etc.) and object-literal function params (fn({ key: val })) collapse onto one line when they fit within wrapWidth. Only applies in --full mode.
collapseMaxMembersnumber4Global fallback for the per-category counts below. Any category not explicitly set uses this value. Structures with more items than their limit stay multi-line regardless of wrapWidth. Only applies in --full mode.
collapseMaxObjectMembersnumbercollapseMaxMembersMax members an object literal may have and still collapse onto one line.
collapseMaxArrayElementsnumbercollapseMaxMembersMax elements an array may have and still collapse onto one line.
collapseMaxFunctionParamsnumbercollapseMaxMembersMax parameters a function declaration may have and still collapse onto one line.
collapseMaxCallArgsnumbercollapseMaxMembersMax arguments a call may have and still collapse onto one line.
collapseMaxImportsnumbercollapseMaxMembersMax named imports a statement may have and still collapse onto one line.
collapseMaxTypeMembersnumbercollapseMaxMembersMax members a type literal may have and still collapse onto one line.
collapseMaxKeyValuePropsnumber1Max key: value ("named") properties an object literal may have and still collapse onto one line. Shorthand ({ a, b }) and spread ({ ...x }) don't count. With the default 1, { x: 1 } stays inline but { x: 1, y: 2 } expands one-per-line. Set high to disable.
tabWidthnumber4Display width of a tab character for line-width measurement. Reettier indents with hard tabs, so deeply nested lines take up more screen columns than their raw length. This value is used when measuring wrapWidth and collapseSoftWidth - set it to match your editor's tab size.
removeUnusedImportsbooleanfalseWhen enabled, unused import declarations are removed from JS/TS files during formatting. Side-effect imports (import "./foo") are always kept. Only applies in --full mode.
onelinebooleantrueWhen enabled, a multi-line HTML element in a .ree file is collapsed onto a single line when the full <tag>content</tag> fits within wrapWidth. Only applies to leaf elements (no child tags); elements that don't fit stay multi-line. Only applies in --full mode.

Example

{
    // Directory names to skip anywhere in the project.
    "skipDirs": ["node_modules", "vendor", "dist", ".output"],
    // Glob patterns for individual files to skip.
    "skipFiles": [],
    // Compound extensions to always skip.
    "skipExtensions": ["min.js"],
    // File extensions to format.
    "extensions": ["ree", "ts", "js", "css"],
    // Skip dot-directories like .git and .cache.
    "skipDotDirs": true,
    // Enable full AST reprint mode (like legacy reefmt). Default is indent mode.
    "full": false,
    // Maximum line width before wrapping (only applies in --full mode).
    "wrapWidth": 180,
    // Soft wrap width - short structures stay inline regardless of count.
    "collapseSoftWidth": 100,
    // Collapse single-statement blocks that fit on one line.
    "collapseSingleStatementBlocks": true,
    // Global fallback for the per-category collapse counts.
    "collapseMaxMembers": 4,
    // Max key:value props an object may have and still collapse.
    "collapseMaxKeyValueProps": 1,
    // Tab display width for line-width measurement.
    "tabWidth": 4,
    // Strip unused imports from JS/TS files.
    "removeUnusedImports": false,
    // Collapse leaf .ree elements onto one line when they fit.
    "oneline": true
}