34 lines
628 B
Plaintext
34 lines
628 B
Plaintext
![]() |
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:
|
||
|
|
||
|
----
|
||
|
function cPrint(... args) { // Noncompliant
|
||
|
console.log(args);
|
||
|
}
|
||
|
|
||
|
function foo(a, b, c) {
|
||
|
}
|
||
|
const arr = [10, 20];
|
||
|
foo(... arr, 30); // Noncompliant
|
||
|
----
|
||
|
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
function cPrint(...args) {
|
||
|
console.log(args);
|
||
|
}
|
||
|
|
||
|
function foo(a, b, c) {
|
||
|
}
|
||
|
const arr = [10, 20];
|
||
|
foo(...arr, 30);
|
||
|
----
|
||
|
|
||
|
|