mirror of
https://github.com/numtide/treefmt.git
synced 2024-09-11 08:55:33 +03:00
This was incorrectly ported from Rust to Go. When provided, `treefmt` will take the contents of stdin and place them into the file provided with the `--stdin` flag, then format it according to the configured formatters. If the file doesn't exist it is created. If it exists, it is first truncated and then populated with stdin. Signed-off-by: Brian McGee <brian@bmcgee.ie>
92 lines
1.7 KiB
TOML
92 lines
1.7 KiB
TOML
# One CLI to format the code tree - https://git.numtide.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.alejandra]
|
|
command = "alejandra"
|
|
includes = ["*.nix"]
|
|
# Act as an example on how to exclude specific files
|
|
excludes = ["examples/nix/sources.nix"]
|
|
priority = 1
|
|
|
|
[formatter.deadnix]
|
|
command = "deadnix"
|
|
options = ["-e"]
|
|
includes = ["*.nix"]
|
|
priority = 2
|
|
|
|
[formatter.ruby]
|
|
command = "rufo"
|
|
options = ["-x"]
|
|
includes = ["*.rb"]
|
|
|
|
[formatter.prettier]
|
|
command = "prettier"
|
|
options = ["--write", "--tab-width", "4"]
|
|
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 "$@"
|
|
""",
|
|
"--", # bash swallows the second argument when using -c
|
|
]
|
|
includes = ["*.sh"]
|
|
|
|
[formatter.terraform]
|
|
# Careful, only terraform 1.3.0 or later accept a list of files.
|
|
# see https://github.com/numtide/treefmt/issues/97
|
|
command = "terraform"
|
|
options = ["fmt"]
|
|
includes = ["*.tf"]
|
|
|
|
[formatter.foo-fmt]
|
|
command = "foo-fmt" |