Reference
CLI
Format, check, and lint HTML+ERB files from a terminal or CI.
Usage
erbfmt [OPTIONS] [FILE]...
erbfmt init [--force]
At least one file path is required for formatting, checking, or linting. Standard input is not currently supported. A single file can use any mode; multiple files require --write, --check, or --lint.
Shell glob expansion can provide multiple paths:
erbfmt --write app/views/**/*.html.erb
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.
--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.-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