From c0df9febb7c7e045ababc10b88dbcbb3f28c724c Mon Sep 17 00:00:00 2001 From: Felix Kling Date: Sun, 10 Feb 2019 22:02:33 -0800 Subject: [PATCH] Docs: `...` is not an operator (#11232) * Docs: `...` is not an operator The `...` in function call syntax is not an operator. It's more of a punctuation supported in various places (function call, function definition, array/object definitions, destructuring syntax), but specific to those. It does not produce a value like actual operators do. I'd appreciate it if we can avoid spreading (no pun intended) this misconception. While "spread argument" isn't an official term either, there is none (https://www.ecma-international.org/ecma-262/9.0/index.html#sec-argument-lists), it's probably the closest reasonable term. Happy for alternative suggestions though, or to hear the reasons why this shouldn't be corrected. * Use "spread syntax" --- docs/rules/prefer-spread.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/rules/prefer-spread.md b/docs/rules/prefer-spread.md index 80893d74f27..0011560c3ce 100644 --- a/docs/rules/prefer-spread.md +++ b/docs/rules/prefer-spread.md @@ -1,4 +1,4 @@ -# Suggest using the spread operator instead of `.apply()`. (prefer-spread) +# Suggest using spread syntax instead of `.apply()`. (prefer-spread) Before ES2015, one must use `Function.prototype.apply()` to call variadic functions. @@ -7,7 +7,7 @@ var args = [1, 2, 3, 4]; Math.max.apply(Math, args); ``` -In ES2015, one can use the spread operator to call variadic functions. +In ES2015, one can use spread syntax to call variadic functions. ```js /*eslint-env es6*/ @@ -18,7 +18,7 @@ Math.max(...args); ## Rule Details -This rule is aimed to flag usage of `Function.prototype.apply()` in situations where the spread operator could be used instead. +This rule is aimed to flag usage of `Function.prototype.apply()` in situations where spread syntax could be used instead. ## Examples @@ -37,7 +37,7 @@ Examples of **correct** code for this rule: ```js /*eslint prefer-spread: "error"*/ -// Using the spread operator +// Using spread syntax foo(...args); obj.foo(...args);