noEmptySource (Markdown)
Summary
Section titled “Summary”- 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.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "suspicious": { "noEmptySource": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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.
# TitleOptions
Section titled “Options”allowComments
Section titled “allowComments”Default: false
Treats comments as meaningful content when set to true, so a comments-only file is valid.
An entirely empty file remains invalid.
{ "linter": { "rules": { "suspicious": { "noEmptySource": { "level": "on", "options": { "allowComments": true } } } } }}Invalid
Section titled “Invalid”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 -->Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.