== Why is this an issue?

The ``++void++`` operator evaluates its argument and unconditionally returns ``++undefined++``. It can be useful in pre-ECMAScript 5 environments, where ``++undefined++`` could be reassigned, but generally, its use makes code harder to understand.


=== Noncompliant code example

[source,javascript]
----
void doSomething();
----


=== Compliant solution

[source,javascript]
----
doSomething();
----


=== Exceptions

No issue is raised when ``++void 0++`` is used in place of ``++undefined++``.

[source,javascript]
----
if (parameter === void 0) {...}
----

No issue is raised when ``++void++`` is used before immediately invoked function expressions.

[source,javascript]
----
void (function() {
   ...
}());
----

No issue is raised when ``++void++``'s argument is a promise.

[source,javascript]
----
const promise = new Promise((resolve, reject) => {
   setTimeout(() => {
      resolve('done');
   }, 3000);
});
void promise;
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this use of the 'void' operator.


=== Highlighting

``++void arg++``


'''
== Comments And Links
(visible only on this page)

=== on 30 Sep 2016, 10:14:28 Elena Vilchik wrote:
\[~ann.campbell.2] Hi! Could you finish this ticket? Thanks!

(I'm struggling to define severity)

=== on 30 Sep 2016, 16:47:30 Ann Campbell wrote:
\[~elena.vilchik] could you supply some code samples?

=== on 30 Sep 2016, 17:13:13 Elena Vilchik wrote:
\[~ann.campbell.2] done

=== on 14 Mar 2017, 10:33:27 Elena Vilchik wrote:
\[~ann.campbell.2] Hi! we added exclusion to this rule: ``++void 0++`` used as ``++undefined++``. Could you update main part of description, as it's outdated now. Thanks!

endif::env-github,rspecator-view[]
