# https://github.com/numtide/treefmt
# https://github.com/numtide/treefmt-nix

on-unmatched = "info"
excludes = ["dist/**", "node_modules/**", "vendor/**"]

[formatter.prettier]
command = "prettier"
options = ["--write"]
includes = ["*.js", "*.json", "*.md", "*.yaml", "*.yml"]

[formatter.just]
command = "just"
options = ["--fmt", "--unstable", "-f"]
includes = ["justfile"]

[formatter.taplo]
command = "taplo"
includes = ["*.toml"]
options = ["format"]

[formatter.nixfmt-rfc-style]
command = "nixfmt"
includes = ["*.nix"]

# Statix doesn't support formatting single files, see https://github.com/oppiliappan/statix/issues/69
# Workaround: https://github.com/numtide/treefmt/issues/241#issuecomment-1614563462
[formatter.statix]
command = "bash"
options = ["-euc", "for file in \"$@\"; do statix fix \"$file\"; done"]
includes = ["*.nix"]
