Skip to content

noVoid

  • Rule available since: v1.0.0
  • Diagnostic Category: lint/complexity/noVoid
  • This rule isn’t recommended, so you need to enable it.
  • This rule doesn’t have a fix.
  • The default severity of this rule is warning.
  • Sources:
biome.json
{
"linter": {
"rules": {
"complexity": {
"noVoid": "error"
}
}
}
}

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.