Where Does StyLua Store Its Config?
StyLua reads stylua.toml from the file's directory upward, falling back to .editorconfig when no config exists.
Last updated
StyLua looks for stylua.toml or .stylua.toml starting at the formatted file and climbing to the invocation directory. Found nothing? It consults .editorconfig next, then built-in defaults.
That .editorconfig fallback surprises Lua teams with mixed toolchains. One explicit file per repo (plus .styluaignore for generated or vendored code) keeps formatting reproducible everywhere StyLua runs.
Where StyLua stores this, by platform
[RepoDir]\stylua.toml
Column width, indent, quotes, syntax disambiguation. Search climbs from the file to the cwd only; --search-parent-directories extends it to XDG config as a last resort.
[RepoDir]/stylua.toml
Same discovery. Prefer .stylua.toml (dotted) at the root so teammates share it; --config-path pins an exact file for CI.
[RepoDir]/stylua.toml
Same layout. Exclude vendored code with .styluaignore (gitignore syntax) rather than bloating the toml with ignore patterns.
Frequently asked questions
My Lua formats differently on two machines. Why?
Keep a .stylua.toml in the repo root, even if it only sets syntax. Without one, parent directory or global configs can leak in and reformat Lua as the wrong dialect.
How do I force StyLua to use one exact config?
Pass --config-path <file>. A missing or malformed file is a hard error, which makes it good for CI pins where silent defaults would hide drift.
Notice an outdated path? Let us know.