Перейти к содержимому

noEmptySource

Это содержимое пока не доступно на вашем языке.

  • Rule available since: v2.2.7
  • 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 source containing only the following is considered empty:

  • Whitespace (spaces, tabs or newlines)
  • Comments
code-block.graphql:2:1 lint/suspicious/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.

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": {
"suspicious": {
"noEmptySource": {
"options": {
"allowComments": true
}
}
}
}
}
}
code-block.graphql:2:1 lint/suspicious/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.