Skip to content

noEmptySource (Markdown)

  • Rule available since: v2.6.0
  • Diagnostic Category: lint/suspicious/noEmptySource
  • This rule isn’t recommended, so you need to enable it.
  • This rule doesn’t have a fix.
  • The default severity of this rule is warning.
biome.json
{
"linter": {
"rules": {
"suspicious": {
"noEmptySource": "error"
}
}
}
}

Disallow empty sources.

A Markdown file is empty when it contains nothing but blank lines and HTML comments (such as <!-- TODO -->). A file that only has front matter is not empty.

By default, whitespace and comments do not count as content.

code-block.md:1:1 lint/suspicious/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠ An empty source is not allowed.

> 1 │
│
> 2 │
│

ℹ Empty sources can clutter the codebase and increase cognitive load; deleting empty sources can help reduce it.

<!-- Only comments -->
code-block.md:1:23 lint/suspicious/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠ An empty source is not allowed.

> 1 │ <!-- Only comments -->
│
> 2 │
│

ℹ Empty sources can clutter the codebase and increase cognitive load; deleting empty sources can help reduce it.

# Title

Default: false

Treats comments as meaningful content when set to true, so a comments-only file is valid. An entirely empty file remains invalid.

biome.json
{
"linter": {
"rules": {
"suspicious": {
"noEmptySource": {
"level": "on",
"options": {
"allowComments": true
}
}
}
}
}
}
code-block.md:1:1 lint/suspicious/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠ An empty source is not allowed.

> 1 │
│
> 2 │
│

ℹ Empty sources can clutter the codebase and increase cognitive load; deleting empty sources can help reduce it.

<!-- Only comments -->