noYamlEmptySequenceEntries (YAML)
Language YAML
Summary
Section titled “Summary”- Rule available since:
v2.6.8 - Diagnostic Category:
lint/nursery/noYamlEmptySequenceEntries - This rule doesn’t have a fix.
- The default severity of this rule is warning.
- Sources:
- Same as
yml/no-empty-sequence-entry
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noYamlEmptySequenceEntries": "error" } } }}Description
Section titled “Description”Disallow empty items in YAML lists.
In YAML, each item of a list written on separate lines starts with a -.
A - with nothing after it adds an item with no value, which YAML reads as null.
This usually happens by mistake, when a value is forgotten or a - is left behind.
An item that has only a tag (such as !!str) or an anchor (such as &name), and no value, is also empty.
If the item is meant to have no value, write null or ~ to make that clear.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”fruits: - apple - - bananacode-block.yaml:3:3 lint/nursery/noYamlEmptySequenceEntries ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This list item is empty.
1 │ fruits:
2 │ - apple
> 3 │ -
│ ^
4 │ - banana
5 │
ℹ An item with no value is read as null, and is often left by mistake.
ℹ Add a value to the item, or remove the item. If the item is meant to have no value, write null instead.
ℹ 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.
- &itemcode-block.yaml:1:1 lint/nursery/noYamlEmptySequenceEntries ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This list item is empty.
> 1 │ - &item
│ ^
2 │
ℹ An item with no value is read as null, and is often left by mistake.
ℹ Add a value to the item, or remove the item. If the item is meant to have no value, write null instead.
ℹ 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.
fruits: - apple - banana - null - ~empty: []Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.