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 most specific one's BasedOnStyles replaces the others—it doesn't add 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:

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.

Related: MinAlertLevel SkippedScopes

Last updated