38 lines
696 B
Plaintext
38 lines
696 B
Plaintext
== Why is this an issue?
|
|
|
|
Shared coding conventions allow teams to collaborate effectively. This rule raises an issue when the use of spaces in a rest parameter or with a spread operator does not conform to the configured requirements.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
With the configured default forbidding parentheses:
|
|
|
|
[source,javascript]
|
|
----
|
|
function cPrint(... args) { // Noncompliant
|
|
console.log(args);
|
|
}
|
|
|
|
function foo(a, b, c) {
|
|
}
|
|
const arr = [10, 20];
|
|
foo(... arr, 30); // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
function cPrint(...args) {
|
|
console.log(args);
|
|
}
|
|
|
|
function foo(a, b, c) {
|
|
}
|
|
const arr = [10, 20];
|
|
foo(...arr, 30);
|
|
----
|
|
|
|
|