Command line
Reettier formats files in place. Point it at a file, a directory, or a glob,
and it rewrites each matching file with the formatted result, printing a line
for every file it touches. By default it formats .ree, .ts, .js, and
.css files.
📘 Reettier reads its settings from a
reettier.jsoncconfig file in your project root. Runreettier --initto generate one - see Configuration for the full list of options.
Format a single file
reettier src/public/index.ree
reettier src/lib/component.ts
reettier src/styles/app.css
Format a directory
Pass a directory and Reettier walks it recursively, formatting every supported file it finds (skipping directories listed in your config):
reettier src/
Format your whole project
With no arguments, Reettier formats every supported file under the current directory:
reettier
Use a glob
Quote the pattern so your shell passes it through to Reettier rather than expanding it first:
reettier "**/*.ree"
reettier "src/**/*.ts"
reettier "src/**/*.{ts,js,css}"
Check mode
Report which files would be reformatted without modifying them. Reettier exits
with code 1 if any file would change, which makes it ideal for CI:
reettier --check
reettier --dry-run
reettier -c
Diff mode
Show a unified diff of the changes that would be made, without writing anything to disk:
reettier --diff
Stdin mode
Format input piped on stdin and write the result to stdout. This is what editor
integrations use under the hood. Pass an extension argument to choose the
language; if omitted, Reettier defaults to .ree:
cat file.ree | reettier --stdin # default: format as Ree
cat file.ts | reettier --stdin .ts # format as TypeScript
cat file.js | reettier --stdin .js # format as JavaScript
cat file.css | reettier --stdin .css # format as CSS
Full AST reprint
Format with complete AST reprint (like the legacy reefmt formatter). By default, Reettier is an
indenter that preserves your line breaks. With --full, it reformats the entire file based on
the AST, collapsing and reflowing code regardless of how it was originally written:
reettier --full
reettier --full "src/**/*.ts"
reettier --full --check
Generate a config
Create a commented reettier.jsonc in the current directory that you can edit to
customize skip rules, file extensions, and formatting behavior:
reettier --init
Check the version
reettier --version
# or
reettier -v
What gets formatted
By default (indentation mode), Reettier:
- Indentation - HTML tags and Ree blocks (
{#if},{#each},{#with}) are re-indented with tabs;{#layout}and{#include}do not open a block. - Directive spacing - loose directives such as
{# if }are tightened to{#if}. - HTML comments -
<!-- ... -->content is preserved exactly, even when it contains tag- or directive-like text. - Preserves line breaks - your original line breaks and formatting decisions are respected. You control where code breaks; Reettier controls indentation.
With --full mode (full AST reprint):
- Complete reformatting - the entire file is reformatted from the AST, collapsing and reflowing code, tag spacing, and structure.
- Tag spacing - spacing between tags and Ree expressions is normalised, and short inline elements are kept on a single line.
- Embedded code -
<script>and<style>bodies, along with standalone.ts,.js, and.cssfiles, are formatted with the built-in SWC formatter. No external tools are required.
Continuous integration
Use --check to fail a CI job when any file is not already formatted, without
touching the working tree:
reettier --check
The command exits non-zero if any file would change, so the step fails until the code is reformatted and committed.