2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2020-06-30 12:47:33 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
include::../noncompliant.adoc[]
|
|
|
|
|
|
|
|
include::../compliant.adoc[]
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Exceptions
|
2020-06-30 12:47:33 +02:00
|
|
|
|
2022-08-10 09:42:53 +02:00
|
|
|
* This rule ignores initializations to -1, 0, 1, ``++undefined++``, [], {}, ``++true++``, ``++false++`` and ``++""++``.
|
|
|
|
* Variables that start with an underscore (e.g. \'``++_unused++``') are ignored.
|
|
|
|
* Assignment of ``++null++`` is ignored because it is sometimes used to help garbage collection
|
|
|
|
* Increment and decrement expressions are ignored because they are often used idiomatically instead of `x+1`
|
|
|
|
* This rule also ignores variables declared with object destructuring using rest syntax (used to exclude some properties from object):
|
2020-06-30 14:49:38 +02:00
|
|
|
|
2022-08-04 15:12:16 +02:00
|
|
|
[source,javascript]
|
2020-06-30 12:47:33 +02:00
|
|
|
----
|
|
|
|
let {a, b, ...rest} = obj; // 'a' and 'b' are ok
|
|
|
|
doSomething(rest);
|
|
|
|
|
|
|
|
let [x1, x2, x3] = arr; // but 'x1' is noncompliant, as omitting syntax can be used: "let [, x2, x3] = arr;"
|
|
|
|
doSomething(x2, x3);
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-09-20 15:38:42 +02:00
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== on 29 Apr 2015, 07:49:23 Ann Campbell wrote:
|
|
|
|
assigned for review of expansion
|
|
|
|
|
|
|
|
=== on 29 Apr 2015, 08:55:42 Linda Martin wrote:
|
|
|
|
Reviewed!
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|