Skip to content

noVoid (since v1.0.0)

Diagnostic Category: lint/complexity/noVoid

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;
complexity/noVoid.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.