summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/prefer-rest-params.js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2016-04-09 14:11:01 +0200
committerJames M Snell <jasnell@gmail.com>2016-04-26 12:15:57 -0700
commit128f58255809c785d097ee98bb24dfb2b870a537 (patch)
treea9a8568c451de82ca10042c362abb0bd17d0ed89 /tools/eslint/lib/rules/prefer-rest-params.js
parentd66d028edc2292955f4fce92516018524e66c664 (diff)
downloadnode-new-128f58255809c785d097ee98bb24dfb2b870a537.tar.gz
tools: update ESLint to 2.7.0
PR-URL: https://github.com/nodejs/node/pull/6132 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
Diffstat (limited to 'tools/eslint/lib/rules/prefer-rest-params.js')
-rw-r--r--tools/eslint/lib/rules/prefer-rest-params.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/eslint/lib/rules/prefer-rest-params.js b/tools/eslint/lib/rules/prefer-rest-params.js
index 8f904d9b6f..d52c1164cb 100644
--- a/tools/eslint/lib/rules/prefer-rest-params.js
+++ b/tools/eslint/lib/rules/prefer-rest-params.js
@@ -18,9 +18,12 @@
*/
function getVariableOfArguments(scope) {
var variables = scope.variables;
+
for (var i = 0; i < variables.length; ++i) {
var variable = variables[i];
+
if (variable.name === "arguments") {
+
// If there was a parameter which is named "arguments", the implicit "arguments" is not defined.
// So does fast return with null.
return (variable.identifiers.length === 0) ? variable : null;
@@ -57,6 +60,7 @@ module.exports = function(context) {
*/
function checkForArguments() {
var argumentsVar = getVariableOfArguments(context.getScope());
+
if (argumentsVar) {
argumentsVar.references.forEach(report);
}