noEmptySource (GraphQL)
Summary
Section titled “Summary”- 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.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "suspicious": { "noEmptySource": "error" } } }}Description
Section titled “Description”Disallow empty sources.
A source containing only the following is considered empty:
- Whitespace (spaces, tabs or newlines)
- Comments
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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.
# Invalid commentquery Member {}fragment StrippedMember on Member {}Options
Section titled “Options”allowComments
Section titled “allowComments”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
{ "linter": { "rules": { "suspicious": { "noEmptySource": { "level": "on", "options": { "allowComments": true } } } } }}Invalid
Section titled “Invalid”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.
# Valid commentRelated links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.