Where Does shfmt Store Its Config?
shfmt has no config file of its own: it reads formatting options from .editorconfig next to your scripts.
Last updated
shfmt outsources its configuration to EditorConfig. An .editorconfig with a [*.sh] section (indent_style, indent_size, binary_next_line and friends) drives formatting whenever no printer flags are passed.
That precedence rule is the whole gotcha. Flags always beat the file, so a stray -i in a script or hook silently discards the team's .editorconfig. Keep flags out of shared wrappers and let the file speak.
Where shfmt stores this, by platform
[RepoDir]\.editorconfig
Indent, dialect, case indent and more via [*.sh] sections ([[shell]] matches shebang-only scripts too). Any CLI flag disables EditorConfig for that run.
[RepoDir]/.editorconfig
Same mechanism. Formatting flags live in the man page; the .editorconfig sample there maps each one to its property name.
[RepoDir]/.editorconfig
Same layout. Piping through stdin needs --filename so shfmt can locate the right .editorconfig for the script.
Frequently asked questions
Where is shfmt's own config file?
You cannot. shfmt only honors .editorconfig plus its own flags, and any explicit flag disables EditorConfig entirely for that run. Encode the style in .editorconfig instead.
How do I make CI ignore local .editorconfig files?
Pass any printer flag (even -i=0). The moment flags appear, EditorConfig is ignored, which is exactly what you want for reproducible CI runs.
Notice an outdated path? Let us know.