mirror of
https://github.com/numtide/treefmt.git
synced 2024-10-26 17:30:03 +03:00
f44033281e
Put a dummy "--" as the first argument, otherwise the first file is always ignored. See https://github.com/numtide/treefmt/issues/77#issuecomment-997030856
91 lines
1.6 KiB
TOML
91 lines
1.6 KiB
TOML
# One CLI to format the code tree - https://github.com/numtide/treefmt
|
|
|
|
[formatter.python]
|
|
command = "black"
|
|
includes = ["*.py"]
|
|
|
|
[formatter.elm]
|
|
command = "elm-format"
|
|
options = ["--yes"]
|
|
includes = ["*.elm"]
|
|
|
|
[formatter.go]
|
|
command = "gofmt"
|
|
options = ["-w"]
|
|
includes = ["*.go"]
|
|
|
|
[formatter.haskell]
|
|
command = "ormolu"
|
|
options = [
|
|
"--ghc-opt", "-XBangPatterns",
|
|
"--ghc-opt", "-XPatternSynonyms",
|
|
"--ghc-opt", "-XTypeApplications",
|
|
"--mode", "inplace",
|
|
"--check-idempotence",
|
|
]
|
|
includes = ["*.hs"]
|
|
excludes = ["examples/haskell/"]
|
|
|
|
[formatter.nix]
|
|
command = "nixpkgs-fmt"
|
|
includes = ["*.nix"]
|
|
# Act as an example on how to exlude specific files
|
|
excludes = ["examples/nix/sources.nix"]
|
|
|
|
[formatter.ruby]
|
|
command = "rufo"
|
|
options = ["-x"]
|
|
includes = ["*.rb"]
|
|
|
|
[formatter.prettier]
|
|
command = "prettier"
|
|
options = ["--write"]
|
|
includes = [
|
|
"*.css",
|
|
"*.html",
|
|
"*.js",
|
|
"*.json",
|
|
"*.jsx",
|
|
"*.md",
|
|
"*.mdx",
|
|
"*.scss",
|
|
"*.ts",
|
|
"*.yaml",
|
|
]
|
|
excludes = ["CHANGELOG.md"]
|
|
|
|
[formatter.rust]
|
|
command = "rustfmt"
|
|
options = ["--edition", "2018"]
|
|
includes = ["*.rs"]
|
|
|
|
[formatter.shell]
|
|
command = "/bin/sh"
|
|
options = [
|
|
"-euc",
|
|
"""
|
|
# First lint all the scripts
|
|
shellcheck "$@"
|
|
|
|
# Then format them
|
|
shfmt -i 2 -s -w "$@"
|
|
""",
|
|
"--",
|
|
]
|
|
includes = ["*.sh"]
|
|
|
|
[formatter.terraform]
|
|
# Terraform fmt only takes one file at the time so we create a wrapper.
|
|
# See https://github.com/numtide/treefmt/issues/97
|
|
command = "/bin/sh"
|
|
options = [
|
|
"-euc",
|
|
"""
|
|
for f in "$@"; do
|
|
terraform fmt "$f"
|
|
done
|
|
""",
|
|
"--",
|
|
]
|
|
includes = ["*.tf"]
|