Created
March 9, 2025 11:02
-
-
Save trin94/9bc04b1fccb0018342aeeadc32fcbc4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# One CLI to format the code tree - https://github.com/numtide/treefmt | |
# Do not exit with error if a configured formatter is missing | |
# Env $TREEFMT_ALLOW_MISSING_FORMATTER | |
# allow-missing-formatter = false | |
# The file into which a cpu profile will be written | |
# Env $TREEFMT_CPU_PROFILE | |
# cpu-profile = ./cpu.pprof | |
# Exclude files or directories matching the specified globs | |
# Env $TREEFMT_EXCLUDES | |
excludes = [ | |
"*.gitignore", | |
"*.lock", | |
"*.txt", | |
"Justfile", | |
] | |
# Exit with error if any changes were made during execution | |
# Useful for CI | |
# Env $TREEFMT_FAIL_ON_CHANGE | |
fail-on-change = false | |
# A list of formatters to apply | |
# Defaults to all configured formatters | |
# Env $TREEFMT_FORMATTERS | |
# formatters = ["gofmt", "prettier"] | |
# Log paths that did not match any formatters at the specified log level | |
# Possible values are <debug|info|warn|error|fatal> | |
# Env $TREEFMT_ON_UNMATCHED | |
# on-unmatched = "info" | |
# The root directory from which treefmt will start walking the filesystem | |
# Defaults to the directory containing the config file | |
# Env $TREEFMT_TREE_ROOT | |
# tree-root = "/tmp/foo" | |
# File to search for to find the tree root (if tree-root is not set) | |
# Env $TREEFMT_TREE_ROOT_FILE | |
# tree-root-file = ".git/config" | |
# Set the verbosity of logs | |
# 0 = warn, 1 = info, 2 = debug | |
# Env $TREEFMT_VERBOSE | |
verbose = 1 | |
# The method used to traverse the files within the tree root | |
# Currently, we support 'auto', 'git' or 'filesystem' | |
# Env $TREEFMT_WALK | |
# walk = "filesystem" | |
#[formatter.mylanguage] | |
## Command to execute | |
#command = "command-to-run" | |
## Command-line arguments for the command | |
#options = [] | |
## Glob pattern of files to include | |
#includes = [ "*.<language-extension>" ] | |
## Glob patterns of files to exclude | |
#excludes = [] | |
## Controls the order of application when multiple formatters match the same file | |
## Lower the number, the higher the precedence | |
## Default is 0 | |
#priority = 0 | |
[formatter.javascript] | |
command = "biome" | |
includes = ["*.js"] | |
options = [ | |
"format", | |
"--arrow-parentheses=as-needed", | |
"--bracket-spacing=true", | |
"--fix", | |
"--indent-size=4", | |
"--indent-style=space", | |
"--indent-width=4", | |
"--line-ending=lf", | |
"--line-width=120", | |
"--semicolons=as-needed", | |
] | |
[formatter.json] | |
command = "biome" | |
includes = ["*.json"] | |
options = [ | |
"format", | |
"--bracket-spacing=true", | |
"--fix", | |
"--indent-size=4", | |
"--indent-style=space", | |
"--indent-width=4", | |
"--json-formatter-enabled=true", | |
"--line-ending=lf", | |
"--line-width=120", | |
] | |
[formatter.markdown] | |
command = "mdformat" | |
includes = ["*.md"] | |
options = ["--number", "--wrap", "keep", "--end-of-line", "lf"] | |
[formatter.python-1] | |
command = "ruff" | |
includes = ["*.py", "*.pyi"] | |
options = ["check", "--fix"] | |
priority = 1 | |
[formatter.python-2] | |
command = "ruff" | |
includes = ["*.py", "*.pyi"] | |
options = ["format"] | |
priority = 2 | |
[formatter.toml] | |
command = "taplo" | |
includes = ["*.toml"] | |
options = [ | |
"format", | |
"--option", | |
"align_comments=true", | |
"--option", | |
"allowed_blank_lines=1", | |
"--option", | |
"array_auto_collapse=false", | |
"--option", | |
"indent_string= ", | |
"--option", | |
"trailing_newline=true", | |
] | |
[formatter.yml] | |
command = "yamlfmt" | |
includes = ["*.yaml", "*.yml"] | |
options = [ | |
"-formatter", | |
"line_ending=lf", | |
"-formatter", | |
"retain_line_breaks_single=true", | |
"-formatter", | |
"scan_folded_as_literal=true", | |
"-formatter", | |
"trim_trailing_whitespace=true", | |
"-formatter", | |
"eof_newline=true", | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment