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

Packages

Learn about Vale's configuration distribution system.

Packages = Google, write-good

[*.md]
BasedOnStyles = Vale, Google, write-good

Packages provide a means of sharing, extending, syncing, and updating Vale configurations.

One upstream package is inherited by several projects, so an upstream change reaches all of them. Within a project, configuration is layered: the first package is overridden by the second, and local configuration overrides both.

In the example above, projects 1 and 2 will have identical configurations (as inherited from the upstream package). Any changes to the upstream package will propagate to both projects.

Structure and hosting

A package is a .zip file that contains a .vale.ini file, a StylesPath folder, or both. You include a package by using the top-level Packages key in your local .vale.ini file:

1

Package types — four accepted values

The Packages key accepts four types of values:

  • A name of a package hosted in the official Package Explorer;

  • a URL to an externally-hosted package;

  • an absolute or relative path to a .zip file located in the local file system; or

  • an absolute or relative path to a directory containing package files.

2

Style-only

Style-only (such as write-good) packages are a .zip archive of a single style folder:

After running the sync command, the style will be added to the active StylesPath.

3

Config-only

Config-only (such as Hugo) packages are a .zip archive of a single .vale.ini file:

After running the sync command, the configuration file will be added to StylesPath/.vale-config according to the order in which it was loaded.

4

Complete

Complete packages contain both a .vale.ini file and an associated StylesPath folder:

The StylesPath should be named “styles” and can contain any typically-supported subfolder—such as styles and vocabularies. The .vale.ini file should reference the included StylesPath:

The packaged StylesPath will be merged with the active local StylesPath and any included configuration files will be added to the local StylesPath/.vale-config folder.

Pinning a version

Naming a package installs its latest release, so the rules it brings can change as the package is updated. To hold a package at a known version, give the release URL in place of the name:

A style takes its name from the folder inside the archive, so BasedOnStyles reads the same either way — only where the package comes from changes. Run sync again after editing the URL to move to a different version.

This is worth doing wherever a new rule arriving on its own would be disruptive, such as a repository several people write in, or a CI job that fails on new alerts.

Ordering

In the case of conflicting configuration, the order in which packages are loaded is important:

In the above example, pkg2 will override any conflicting configuration from pkg1. Similarly, local configuration will override any conflicting package.

VCS

You’ll want to add any packaged configuration components to your .gitignore (or equivalent) file.

While this can be as simple as ignoring your entire StylesPath, it’s likely that you’ll also have some local components as well.

The above example ignores the entire .github/styles/ folder except for .github/styles/config/vocabularies/Base (which we want to track changes for).

Last updated