Skip to content

blockMappings

Prefer block-style mappings over flow-style mappings.

✅ This rule is included in the yaml stylistic 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.

key: { nested: value }
outer: { inner: value, another: data }

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.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.