noYamlEmptyMapValues (YAML)
Language YAML
Summary
Section titled “Summary”- Rule available since:
v2.6.8 - Diagnostic Category:
lint/nursery/noYamlEmptyMapValues - This rule doesn’t have a fix.
- The default severity of this rule is warning.
- Sources:
- Same as
yml/no-empty-mapping-value
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noYamlEmptyMapValues": "error" } } }}Description
Section titled “Description”Disallow keys without a value in YAML maps.
When a key in a map has nothing after it, YAML reads its value as null.
This is usually a mistake, such as a value that was forgotten or deleted by accident.
This rule also reports values that only have a tag (such as !!str) or an anchor (such as &name),
because these values are empty too.
If the value is meant to be empty, write it out, for example as null, so the intent is clear.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”name:code-block.yaml:1:1 lint/nursery/noYamlEmptyMapValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This key has no value.
> 1 │ name:
│ ^^^^^
2 │
ℹ An empty value is easy to miss, and is often a value that was forgotten.
ℹ Add a value. If the value is meant to be empty, write it out, for example as null.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
person: { name: }code-block.yaml:1:11 lint/nursery/noYamlEmptyMapValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This key has no value.
> 1 │ person: { name: }
│ ^^^^^
2 │
ℹ An empty value is easy to miss, and is often a value that was forgotten.
ℹ Add a value. If the value is meant to be empty, write it out, for example as null.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
? namecode-block.yaml:1:1 lint/nursery/noYamlEmptyMapValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This key has no value.
> 1 │ ? name
│ ^^^^^^
2 │
ℹ An empty value is easy to miss, and is often a value that was forgotten.
ℹ Add a value. If the value is meant to be empty, write it out, for example as null.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
name: !!strcode-block.yaml:1:1 lint/nursery/noYamlEmptyMapValues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This key has no value.
> 1 │ name: !!str
│ ^^^^^^^^^^^
2 │
ℹ An empty value is easy to miss, and is often a value that was forgotten.
ℹ Add a value. If the value is meant to be empty, write it out, for example as null.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
name: John Doenickname: nulltitle: ""person: { name: John Doe }Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.