Reference
CLI
Format, check, and lint HTML+ERB files from a terminal or CI.
Usage
erbfmt [OPTIONS] [FILE_OR_DIRECTORY]...
erbfmt init [--force]
At least one file or directory path is required for formatting, checking, or linting. Standard input is not currently supported. A single file can use any mode; multiple files or directory inputs require --write, --check, or --lint.
Directory inputs are searched recursively. Discovered files are filtered by files.includes; without files.includes, recursive discovery targets *.html.erb files. Shell glob expansion can also provide multiple paths:
erbfmt --write app/views/**/*.html.erb
For recursive project usage, pass a directory directly:
erbfmt --write app/views
erbfmt --check app/views
erbfmt --lint app/views
Modes
erbfmt FILEFormats one file and prints the result to standard output without changing the source file.
--writeFormats each file in place. A successful write prints one confirmation line per file.
--checkChecks whether formatting would change each file without writing it. The command fails when any file is not formatted.
--lintRuns lint diagnostics without formatting. Error diagnostics fail the command; warning-only results succeed. Diagnostics use the human-readable
prettyformat by default.
--write, --check, and --lint are mutually exclusive.
Options
--config PATHUses the specified
erbfmt.json. Without this option, erbfmt searches the current directory and then its parents. If no config is found, built-in defaults are used.--lint-format pretty|plain|jsonControls lint diagnostic output.
prettyis the default and includes severity labels, source excerpts, carets, and a summary.plainpreserves the compactfile: message at line, columnformat.jsonemits one machine-readable JSON object per file for AI agents, scripts, and editor integrations.-h, --helpPrints command help and exits.
-V, --versionPrints the installed erbfmt version and exits.
See the configuration reference for every formatter and linter setting.
Init
Create the default erbfmt.json in the current directory:
erbfmt init
The command refuses to replace an existing file. Overwrite it explicitly with:
erbfmt init --force
Exit status
0Formatting or writing completed, every checked file was formatted, or lint found no error-level diagnostics.
1A checked file needs formatting, lint found an error, a required file was missing, or file/config parsing failed.
2An option was invalid or mutually exclusive mode flags were combined.
CI examples
erbfmt --check app/views/**/*.html.erb
erbfmt --lint app/views/**/*.html.erb