noEmptySource
Este conteúdo não está disponível em sua língua ainda.
Summary
Section titled “Summary”- Rule available since:
v2.2.7 - Diagnostic Category:
lint/nursery/noEmptySource - This rule doesn’t have a fix.
- The default severity of this rule is information.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "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/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.
query 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": { "nursery": { "noEmptySource": { "options": { "allowComments": true } } } } }}Invalid
Section titled “Invalid”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.
Related links
Section titled “Related links”Summary
Section titled “Summary”- Rule available since:
v2.2.7 - Diagnostic Category:
lint/nursery/noEmptySource - This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
no-empty-source
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "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.css: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.
/* Only comments */code-block.css:2:1 lint/nursery/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.
a { }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": { "nursery": { "noEmptySource": { "options": { "allowComments": true } } } } }}Invalid
Section titled “Invalid”code-block.css: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.
/* Only comments */Related links
Section titled “Related links”Summary
Section titled “Summary”- Rule available since:
v2.2.7 - Diagnostic Category:
lint/nursery/noEmptySource - This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
unicorn/no-empty-file
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noEmptySource": "error" } } }}Description
Section titled “Description”Disallow empty sources.
A source containing only the following is considered empty:
- Whitespace (spaces, tabs or newlines)
- Comments
- Directives
- Empty statements
- Empty block statements
- Hashbang
Examples
Section titled “Examples”Invalid
Section titled “Invalid”code-block.js: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.
// Only commentscode-block.js:2:1 lint/nursery/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.
/* Only comments */code-block.js:2:1 lint/nursery/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.
'use strict';code-block.js:1:1 lint/nursery/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ An empty source is not allowed.
> 1 │ ‘use strict’;
│ ^^^^^^^^^^^^^
2 │
ℹ Empty sources can clutter the codebase and increase cognitive load; deleting empty sources can help reduce it.
;code-block.js:1:1 lint/nursery/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.
{}code-block.js:1:1 lint/nursery/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ An empty source is not allowed.
> 1 │ {
│ ^
> 2 │ }
│ ^
3 │
ℹ Empty sources can clutter the codebase and increase cognitive load; deleting empty sources can help reduce it.
#!/usr/bin/env nodecode-block.js:1:1 lint/nursery/noEmptySource ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ An empty source is not allowed.
> 1 │ #!/usr/bin/env node
│ ^^^^^^^^^^^^^^^^^^^
2 │
ℹ Empty sources can clutter the codebase and increase cognitive load; deleting empty sources can help reduce it.
const x = 0;'use strict';const x = 0;;;const x = 0;{ const x = 0;}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": { "nursery": { "noEmptySource": { "options": { "allowComments": true } } } } }}Invalid
Section titled “Invalid”code-block.js: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.
/* Only comments */Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.