38 lines
859 B
Plaintext
Raw Normal View History

== Why is this an issue?
When the call to a function doesn't have any side effects, what is the point of making the call if the results are ignored? In such case, either the function call is useless and should be dropped or the source code doesn't behave as expected.
2021-02-02 15:02:10 +01:00
To prevent generating any false-positives, this rule triggers an issues only on a predefined list of known objects & functions.
=== Noncompliant code example
2022-02-04 17:28:24 +01:00
[source,javascript]
----
'hello'.lastIndexOf('e'); // Noncompliant
----
=== Compliant solution
2022-02-04 17:28:24 +01:00
[source,javascript]
----
let char = 'hello'.lastIndexOf('e');
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]