Skip to content
Latchkey

yamllint .yamllint Configuration

yamllint is configured by .yamllint (or .yamllint.yaml/.yml), where extends picks a base preset and rules tunes individual checks.

The config decides how strict each rule is and which files to skip. Most projects extend the default preset and relax a few rules.

What it does

yamllint loads .yamllint, .yamllint.yaml, or .yamllint.yml from the working directory. extends inherits a built-in preset (default or relaxed), rules configures each check (with a level of error/warning or disable), and ignore lists glob patterns to skip.

Common usage

.yamllint
extends: default
rules:
  line-length:
    max: 120
    level: warning
  document-start: disable
  trailing-spaces: enable
ignore: |
  vendor/
  node_modules/

Config keys

KeyWhat it does
extendsBase preset: default or relaxed
rules.<rule>Configure a rule; enable, disable, or set options
rules.<rule>.levelerror or warning for that rule
rules.line-length.maxMaximum line length (default 80)
ignoreGlob patterns of files to skip
yaml-filesFilename patterns yamllint treats as YAML

Common errors in CI

"invalid config: no such rule: X" means a rule name typo or a rule from a newer yamllint. "invalid config: line-length: ..." means a bad option type. The default preset sets line-length.max to 80, which surprises teams with longer lines; raise max or set its level to warning.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →