noEmptyPattern
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/correctness/noEmptyPattern¥Diagnostic Category:
lint/correctness/noEmptyPattern -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
no-empty-pattern相同¥Same as
no-empty-pattern
-
¥How to configure
{ "linter": { "rules": { "correctness": { "noEmptyPattern": "error" } } }}¥Description
禁止空的解构模式。
¥Disallows empty destructuring patterns.
¥Examples
¥Invalid
var {} = foo;code-block.js:1:5 lint/correctness/noEmptyPattern ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unexpected empty object pattern.
> 1 │ var {} = foo;
│ ^^
2 │
var {a: {}} = foo;code-block.js:1:9 lint/correctness/noEmptyPattern ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unexpected empty object pattern.
> 1 │ var {a: {}} = foo;
│ ^^
2 │
function foo({}) {}code-block.js:1:14 lint/correctness/noEmptyPattern ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unexpected empty object pattern.
> 1 │ function foo({}) {}
│ ^^
2 │
¥Valid
以下情况有效,因为它们会创建新的绑定。
¥The following cases are valid because they create new bindings.
var {a = {}} = foo;var {a, b = {}} = foo;var {a = []} = foo;function foo({a = {}}) {}function foo({a = []}) {}var [a] = foo;¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号