noEmptySource
¥Summary
-
规则生效日期:
v2.2.7¥Rule available since:
v2.2.7 -
诊断类别:
lint/nursery/noEmptySource¥Diagnostic Category:
lint/nursery/noEmptySource -
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 information。
¥The default severity of this rule is information.
¥How to configure
{ "linter": { "rules": { "nursery": { "noEmptySource": "error" } } }}¥Description
禁止使用空源。
¥Disallow empty sources.
仅包含以下内容的源被视为空:
¥A source containing only the following is considered empty:
-
空格(空格、制表符或换行符)
¥Whitespace (spaces, tabs or newlines)
-
评论
¥Comments
¥Examples
¥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.
¥Valid
query Member {}fragment StrippedMember on Member {}¥Options
allowComments
Section titled “allowComments”注释是否应标记为有意义。当此选项设置为 true 时,仅包含注释的文件也被视为有效。
¥Whether the comments should be marked as meaningful.
When this option has been set to true, a file with only comments is considered valid.
默认 false
¥Default false
{ "linter": { "rules": { "nursery": { "noEmptySource": { "options": { "allowComments": true } } } } }}¥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.
¥Valid
¥Related links
¥Summary
-
规则生效日期:
v2.2.7¥Rule available since:
v2.2.7 -
诊断类别:
lint/nursery/noEmptySource¥Diagnostic Category:
lint/nursery/noEmptySource -
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 information。
¥The default severity of this rule is information.
-
来源:
¥Sources:
-
与
no-empty-source相同¥Same as
no-empty-source
-
¥How to configure
{ "linter": { "rules": { "nursery": { "noEmptySource": "error" } } }}¥Description
禁止使用空源。
¥Disallow empty sources.
仅包含以下内容的源被视为空:
¥A source containing only the following is considered empty:
-
空格(空格、制表符或换行符)
¥Whitespace (spaces, tabs or newlines)
-
评论
¥Comments
¥Examples
¥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.
¥Valid
a { }¥Options
allowComments
Section titled “allowComments”注释是否应标记为有意义。当此选项设置为 true 时,仅包含注释的文件也被视为有效。
¥Whether the comments should be marked as meaningful.
When this option has been set to true, a file with only comments is considered valid.
默认 false
¥Default false
{ "linter": { "rules": { "nursery": { "noEmptySource": { "options": { "allowComments": true } } } } }}¥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.
¥Valid
/* Only comments */¥Related links
¥Summary
-
规则生效日期:
v2.2.7¥Rule available since:
v2.2.7 -
诊断类别:
lint/nursery/noEmptySource¥Diagnostic Category:
lint/nursery/noEmptySource -
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 information。
¥The default severity of this rule is information.
-
来源:
¥Sources:
-
¥Same as
unicorn/no-empty-file
-
¥How to configure
{ "linter": { "rules": { "nursery": { "noEmptySource": "error" } } }}¥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
¥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.
¥Valid
const x = 0;'use strict';const x = 0;;;const x = 0;{ const x = 0;}¥Options
allowComments
Section titled “allowComments”注释是否应标记为有意义。当此选项设置为 true 时,仅包含注释的文件也被视为有效。
¥Whether the comments should be marked as meaningful.
When this option has been set to true, a file with only comments is considered valid.
默认 false
¥Default false
{ "linter": { "rules": { "nursery": { "noEmptySource": { "options": { "allowComments": true } } } } }}¥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.
¥Valid
/* Only comments */¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号