diff --git a/formatter.nix b/formatter.nix index 121795a1..ab483587 100644 --- a/formatter.nix +++ b/formatter.nix @@ -46,5 +46,55 @@ ]; includes = [ "*.py" ]; }; + treefmt.settings.formatter.vale = + with pkgs; + let + vocab = "cLAN"; + style = "Docs"; + config = writeText "vale.ini" '' + StylesPath = ${styles} + Vocab = ${vocab} + + [*.md] + BasedOnStyles = Vale, ${style} + Vale.Terms = No + ''; + styles = symlinkJoin { + name = "vale-style"; + paths = [ + accept + headings + ]; + }; + accept = writeTextDir "config/vocabularies/${vocab}/accept.txt" '' + cLAN + Nix + NixOS + Nixpkgs + clan.lol + Clan + monorepo + ''; + headings = writeTextDir "${style}/headings.yml" '' + extends: capitalization + message: "'%s' should be in sentence case" + level: error + scope: heading + # $title, $sentence, $lower, $upper, or a pattern. + match: $sentence + ''; + in + { + command = "${vale}/bin/vale"; + options = [ "--config=${config}" ]; + includes = [ "*.md" ]; + # TODO: too much at once, fix piecemeal + excludes = [ + "README.md" + "docs/*" + "clanModules/*" + "pkgs/*" + ]; + }; }; }