For the complete documentation index, see llms.txt. This page is also available as Markdown.

BasedOnStyles

Learn how to enable a style for a specific file type.

StylesPath = styles

[*.md]
BasedOnStyles = Vale, MyStyle

BasedOnStyles enables every rule in the named styles for the files a section matches.

It's a section-level setting, so it has to appear under a glob. Putting it above the first section is an error:

'BasedOnStyles' is a syntax-specific option

To apply styles to everything, use the catch-all section:

[*]
BasedOnStyles = Vale

More than one section

When several sections match a file, the last one written takes it: its BasedOnStyles replaces the others rather than adding to them.

[*]
BasedOnStyles = Vale

[*.md]
# Markdown files get Microsoft *instead of* Vale, not as well as.
BasedOnStyles = Microsoft

If you want the defaults plus something extra, name them all:

Individual rules

Rules can be switched on or off by name, and unlike BasedOnStyles, these settings accumulate across every section that matches:

That's the way to extend your defaults for one file type without repeating them.

Turning a rule off works the same way:

A rule can also be enabled on its own, without its style being listed at all:

Starting over

Requires Vale v3.22.0 or later.

An empty BasedOnStyles clears everything a file inherited from earlier sections, the rule settings as well as the styles, so the section starts from nothing:

NONE is the spelled-out form of an empty value, and requires Vale v3.24.0 or later; BasedOnStyles = with nothing after it does the same. A file left with no rule to run isn't read at all.

A rule named in that section still runs. To drop one inherited setting rather than all of them, set it to UNSET: the rule follows BasedOnStyles again, as if the earlier line had not been written.

UNSET works on a style name too, write-good = UNSET, and leaves the settings of individual rules in place.

Severity

The same syntax sets a rule's level, which overrides whatever the rule file declares:

Setting a level for a whole style requires Vale v3.17.0 or later.

A bare style name sets the default for every rule in that style, and a rule naming itself still wins:

This is the concise way to keep one part of a style while turning the rest down—or off:

See MinAlertLevel for how levels affect Vale's exit code.

Parameters

Bracketed parameters require Vale v3.20.0 or later.

A bracketed key overrides one scalar on a rule you have enabled, keeping the rule's identity:

Values are coerced to the field's type at compile time, and an unknown parameter fails the rule's compilation rather than being silently dropped.

Only scalars can be tuned this way. A structural field — tokens, swap, message — is refused with a pointer at extending the rule in a style, which is what authoring is for. [level] is refused too: the classic Style.Rule = warning syntax already says that.

Last updated