mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-30 12:07:46 +00:00
feat: format toml
This commit is contained in:
parent
c07a964d8a
commit
59c879aedb
5 changed files with 194 additions and 66 deletions
55
treefmt.toml
55
treefmt.toml
|
@ -1,59 +1,24 @@
|
|||
# One CLI to format the code tree - https://github.com/numtide/treefmt
|
||||
[formatter]
|
||||
|
||||
[formatter.json]
|
||||
command = "jq"
|
||||
includes = ["*.json"]
|
||||
options = ["-S"]
|
||||
|
||||
[formatter.nix]
|
||||
command = "./target/debug/alejandra"
|
||||
command = "alejandra"
|
||||
includes = ["*.nix"]
|
||||
|
||||
[formatter.prettier]
|
||||
command = "prettier"
|
||||
options = ["--write"]
|
||||
includes = [
|
||||
"*.css",
|
||||
"*.html",
|
||||
"*.js",
|
||||
"*.json",
|
||||
"*.jsx",
|
||||
"*.md",
|
||||
"*.mdx",
|
||||
"*.scss",
|
||||
"*.ts",
|
||||
"*.yaml",
|
||||
]
|
||||
includes = ["*.md", "*.toml", "*.yaml"]
|
||||
options = ["--plugin", "prettier-plugin-toml", "--write"]
|
||||
|
||||
[formatter.rust]
|
||||
command = "rustfmt"
|
||||
options = [
|
||||
"--edition", "2021",
|
||||
"--config",
|
||||
"""enum_discrim_align_threshold=999,\
|
||||
format_code_in_doc_comments=true,\
|
||||
format_generated_files=true,\
|
||||
format_macro_bodies=true,\
|
||||
format_macro_matchers=true,\
|
||||
format_strings=true,\
|
||||
hex_literal_case=Lower,\
|
||||
imports_granularity=Crate,\
|
||||
imports_layout=HorizontalVertical,\
|
||||
max_width=80,\
|
||||
normalize_comments=true,\
|
||||
normalize_doc_attributes=true,\
|
||||
reorder_impl_items=true,\
|
||||
struct_field_align_threshold=999,\
|
||||
unstable_features=true,\
|
||||
use_small_heuristics=Max,\
|
||||
version=Two""",
|
||||
]
|
||||
includes = ["*.rs"]
|
||||
|
||||
[formatter.shell]
|
||||
command = "shfmt"
|
||||
options = [
|
||||
"-bn", # binary ops like && and | may start a line
|
||||
"-ci", # switch cases will be indented
|
||||
"-sr", # redirect operators will be followed by a space
|
||||
"-i", "2", # indent 2
|
||||
"-s", # simplify the code
|
||||
"-w", # write back to the file
|
||||
]
|
||||
includes = ["*.sh"]
|
||||
|
||||
options = ["-bn", "-ci", "-sr", "-i", "2", "-s", "-w"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue