forked from clan/clan-core
add Vale for prose linting
This commit is contained in:
parent
8f0e537d34
commit
d40563ea9f
@ -45,5 +45,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/*"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user