1
1
forked from extern/flakelight

Clarify use of formatter option

The fact it uses bash is an implementation detail. Update the
documentation to state that the input is a file name glob rather than a
bash case match. Updates the default formatters to not rely on being a
bash case statement.
This commit is contained in:
Archit Gupta 2023-09-16 20:59:54 -07:00
parent 1bc31924ee
commit 592cb247bf
2 changed files with 6 additions and 4 deletions

View File

@ -587,9 +587,9 @@ By default, `nix` files are formatted with `nixpkgs-fmt` and `md`, `json`, and
To disable default formatters, set the `flakelight.builtinFormatters` option to
false.
You can set `formatters` to an attribute set, for which the keys are a bash case
pattern and the value is the formatting command. `formatters` can optionally be
a function that takes packages and returns the above.
You can set `formatters` to an attribute set, for which the keys are a file name
pattern and the value is the corresponding formatting command. `formatters` can
optionally be a function that takes packages and returns the above.
Formatting tools should be added to `devShell.packages` and all packages in
`devShell.packages` will be available for formatting commands.

View File

@ -18,7 +18,9 @@ in
formatters = {
"*.nix" = "nixpkgs-fmt";
"*.md | *.json | *.yml" = "prettier --write";
"*.md" = "prettier --write";
"*.json" = "prettier --write";
"*.yml" = "prettier --write";
};
};
}