Aller au contenu

noVoid

Ce contenu n’est pas encore disponible dans votre langue.

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.