Skip to content

blockMappings

Prefer block-style mappings over flow-style mappings.

✅ This rule is included in the yaml stylistic and stylisticStrict presets.

Flow-style mappings (e.g., {key: value}) can be harder to read and maintain, especially with nested structures. Block-style mappings use indentation to show structure, making the YAML more readable and consistent with common YAML conventions.

11k53: <{ sp ansty="le--0:#7FDBCA;--1:#1111">11nest53<: sp ansty="le--0:#ECC48D;--1:#3B61">B0val53< }d ivclassNa="meco">< }d>11out53: <{ sp ansty="le--0:#7FDBCA;--1:#1111">11inn53<: sp ansty="le--0:#ECC48D;--1:#3B61">B0val53<, sp ansty="le--0:#7FDBCA;--1:#1111">11anoth53<: sp ansty="le--0:#ECC48D;--1:#3B61">B0da53< }d ivclassNa="meco">< }d>
111<1key spans="tyle--0:#D6DEEB;--1:#40">3de1111ne3F<53: spans="tyle--0:#ECC48D;--1:#3B">61B0v1111o3de1111i3F<53: spans="tyle--0:#ECC48D;--1:#3B">61B0vde1111ano3F<53: spans="tyle--0:#ECC48D;--1:#3B">61B0

This rule is not configurable.

If you’re working with a large existing YAML codebase that predominantly uses flow-style mappings and refactoring would be too disruptive, you might choose to disable this rule. However, block-style mappings are generally more readable and maintainable, especially as configurations grow in complexity.