yml/block-mapping
require or disallow block style mappings.
- ⚙️ This rule is included in
"plugin:yml/standard"
. - 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
📖 Rule Details
This rule aims to use consistent style of block or flow styles.
# eslint yml/block-mapping: 'error'
# ✓ GOOD
- a: b
c: d
- { foo: bar }
# ✗ BAD
- { a: b,
c: d }
🔧 Options
yaml
yml/block-mapping:
- error
- always # or "never"
---
# or
yml/block-mapping:
- error
- singleline: always # or "never" or "ignore"
multiline: always # or "never" or "ignore"
Styles
"always"
... Enforce the use of block style mappings."never"
... Disallow the use of block style mappings."ignore"
... Does not apply consistent style.
Properties
- As a string ... Specify the style you want to apply to mappings.
"singleline"
... Specify the style you want to apply when the mapping is single-line. default"ignore"
"multiline"
... Specify the style you want to apply when the mapping is multi-line. default"always"
"always"
# eslint yml/block-mapping: ['error', 'always']
# ✓ GOOD
- a: b
c: d
# ✗ BAD
- { foo: bar }
- { a: b,
c: d }
"never"
# eslint yml/block-mapping: ['error', 'never']
# ✓ GOOD
- { foo: bar }
- { a: b,
c: d }
# ✗ BAD
- foo: bar
- a: b
c: d
👫 Related rules
🚀 Version
This rule was introduced in eslint-plugin-yml v0.1.0