Skip to content

noEmptySource

biome.json
{
"linter": {
"rules": {
"nursery": {
"noEmptySource": "error"
}
}
}
}

Disallow empty sources.

A source containing only the following is considered empty:

  • Whitespace (spaces, tabs or newlines)
  • Comments
code-block.graphql:2:1 lint/nursery/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

An empty source is not allowed.

> 2 │


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

code-block.graphql:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Expected a definition but instead found ‘Only comments’.

> 1 │ Only comments
^^^^^^^^^^^^^
2 │

Expected a definition here.

> 1 │ Only comments
^^^^^^^^^^^^^
2 │

query Member {}
fragment StrippedMember on Member {}

Whether the comments should be marked as meaningful. When this option has been set to true, a file with only comments is considered valid.

Default false

biome.json
{
"linter": {
"rules": {
"nursery": {
"noEmptySource": {
"options": {
"allowComments": true
}
}
}
}
}
}
code-block.graphql:2:1 lint/nursery/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

An empty source is not allowed.

> 2 │


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

code-block.graphql:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Expected a definition but instead found ‘Only comments’.

> 1 │ Only comments
^^^^^^^^^^^^^
2 │

Expected a definition here.

> 1 │ Only comments
^^^^^^^^^^^^^
2 │