Skip to content
You are currently reading docs for v1.x. Go to the latest docs if you are using newer version.

noVoid

Diagnostic Category: lint/complexity/noVoid

Since: v1.0.0 Sources:

Disallow the use of void operators, which is not a familiar operator.

The void operator is often used merely to obtain the undefined primitive value, usually using void(0) (which is equivalent to void 0). In these cases, the global variable undefined can be used.

void 0;
code-block.js:1:1 lint/complexity/noVoid ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The use of void is not allowed.

> 1 │ void 0;
^^^^^^
2 │

If you use void to alter the return type of a function or return undefined, use the global undefined instead.

biome.json
{
"linter": {
"rules": {
"complexity": {
"noVoid": "error"
}
}
}
}