Each of these would send a user down a path Vale does not support: Core options placed under a glob header are not scoped to that glob — Vale rejects them with E201, so the guidance to nest them produced a config that will not load. The built-in `Vale` style is compiled in, but Vale still requires StylesPath to exist on disk before it will run, so the "no StylesPath needed" shortcut fails. The MDX guidance was inverted: under `[formats] mdx = md` the mapping is what makes MDX lint at all, and it needs the mdx2vast prerequisite that was never mentioned. And a spelling rule's `ignore` paths resolve against StylesPath, not against the rule file's own directory, so the documented relative paths silently matched nothing.
4.0 KiB
4.0 KiB
name, description, metadata
| name | description | metadata | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| vale-config | Use when installing or configuring Vale, the prose/style linter — writing a `.vale.ini` whose styles are fetched and actually activated — even when the user says only "set up prose linting". Not running Vale on an existing config -> `vale-run`. |
|
Gotchas
- A style in
BasedOnStylesthat is neither built-in nor a directory underStylesPathfails hard, not silently:E100 [loadStyles], exit 2, nothing linted. vale syncalone does not clear thatE100. Sync fetches only what the top-levelPackageskey declares, so against aBasedOnStyles-only name it reportsSynced 0 package(s)and exits 0, fetching nothing. Add the style toPackages, then sync. A style lints only once it is in both keys — and the reverse case is silent, exiting 0.- Only package styles need fetching: built-in
Vale, and any style whose YAML is already committed underStylesPath, lint with noPackagesentry and no sync. .vale.iniorder is enforced, not stylistic: put core settings first, then[formats], then glob sections. A core setting (StylesPath,MinAlertLevel,Vocab,IgnoredScopes,SkippedScopes) written below a[glob]header is a hard error —E201 ... 'StylesPath' is a core option; it should be defined above any syntax-specific options, exit 2, nothing linted.Packagesis the exception, and the worse one: below a glob header it is accepted with no error, then ignored —vale syncreportsSynced 0 package(s)and downloads nothing.- A rule scoped to
text.frontmatter.<key>silently matches nothing when the field spans multiple lines in most YAML forms. If you scope a rule to frontmatter, readreferences/configuration-reference.mdfirst.
Setup workflow
- Install the
valebinary:brew install vale(macOS),snap install vale(Linux),choco install vale(Windows), ordocker pull jdkato/vale. - Pick a
StylesPath(conventionallystyles) and create it. This is where all styles, dictionaries, and vocab live. - Write
.vale.iniat the project root with at minimum:StylesPath = styles MinAlertLevel = suggestion [*.md] BasedOnStyles = ValeValehere is the built-in style (Vale.Spelling,Vale.Terms,Vale.Avoid,Vale.Repetition): noPackagesentry and novale sync. It still needs theStylesPathdirectory to exist — declareStylesPath = styleswithout creatingstyles/and even aVale-only config dies withE201 ... The path '...' does not exist, exit 2. That is why the previous step creates the directory. - Add third-party styles (optional) by declaring them in
Packages, then activating them in the same or another glob'sBasedOnStyles:Packages = Google, write-good [*.md] BasedOnStyles = Vale, Google, write-good - Sync: run
vale syncto download everything listed inPackagesintoStylesPath. - Verify activation: confirm every style named in
Packagesalso appears in at least one glob'sBasedOnStyles— an unreferenced package downloads but never lints anything.
For the full .vale.ini field reference (formats mapping, vocab, local overrides, custom rule header fields) and the verified style-resolution matrix — which error each misconfiguration raises, and the two that exit 0 while linting nothing — read references/configuration-reference.md.
Custom styles
A custom style is just a new subdirectory under StylesPath, holding one YAML file per rule:
styles/
└── MyStyle/
└── NoJargon.yml
Each rule file needs extends (the check it implements, e.g. existence) and message at minimum. Activate the style the same way as any other: add MyStyle to BasedOnStyles for the relevant glob. If a rule needs a field beyond those two, read references/configuration-reference.md for the full rule header field table.