noVoid
Summary
Section titled “Summary”- Rule available since:
v1.0.0 - Diagnostic Category:
lint/complexity/noVoid - This rule doesn’t have a fix.
- The default severity of this rule is warning.
- Sources:
- Same as
no-void
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "complexity": { "noVoid": "error" } } }}Description
Section titled “Description”Disallow the use of void operators, which is not a familiar operator.
The
voidoperator is often used merely to obtain the undefined primitive value, usually usingvoid(0)(which is equivalent tovoid 0). In these cases, the global variableundefinedcan be used.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”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.
Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.