跳转到内容

noSparseArray

此内容尚不支持你的语言。

Diagnostic Category: lint/suspicious/noSparseArray

Since: v1.0.0

Sources:

Disallow sparse arrays

[1,,2]
code-block.js:1:1 lint/suspicious/noSparseArray  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This array contains an empty slot.

> 1 │ [1,,2]
^^^^^^
2 │

Unsafe fix: Replace hole with undefined

1 │ [1,·undefined,2]
++++++++++
biome.json
{
"linter": {
"rules": {
"suspicious": {
"noSparseArray": "error"
}
}
}
}