add Vale for prose linting
This commit is contained in:
parent
f1c02bbd46
commit
53d5184dd8
@ -46,5 +46,55 @@
|
|||||||
];
|
];
|
||||||
includes = [ "*.py" ];
|
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