From 0daf57623ec7e6b0a04f1dbbb80f7cd53f5b33f4 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Wed, 27 Sep 2017 23:34:46 -0700 Subject: [PATCH] tools: remove no-let-in-for-declaration lint rule After the upgrade of V8 to a version powered by TurboFan, the recommendation not to use `var` for `for` loops is obsolete. --- lib/.eslintrc.yaml | 1 - .../eslint-rules/no-let-in-for-declaration.js | 46 ------------------- 2 files changed, 47 deletions(-) delete mode 100644 tools/eslint-rules/no-let-in-for-declaration.js diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 24f54e682636ee..51db0e38a93ab0 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -2,4 +2,3 @@ rules: # Custom rules in tools/eslint-rules require-buffer: error buffer-constructor: error - no-let-in-for-declaration: error diff --git a/tools/eslint-rules/no-let-in-for-declaration.js b/tools/eslint-rules/no-let-in-for-declaration.js deleted file mode 100644 index 8b1a6783e0773d..00000000000000 --- a/tools/eslint-rules/no-let-in-for-declaration.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @fileoverview Prohibit the use of `let` as the loop variable - * in the initialization of for, and the left-hand - * iterator in forIn and forOf loops. - * - * @author Jessica Quynh Tran - */ - -'use strict'; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -module.exports = { - create(context) { - - const msg = 'Use of `let` as the loop variable in a for-loop is ' + - 'not recommended. Please use `var` instead.'; - - /** - * Report function to test if the for-loop is declared using `let`. - */ - function testForLoop(node) { - if (node.init && node.init.kind === 'let') { - context.report(node.init, msg); - } - } - - /** - * Report function to test if the for-in or for-of loop - * is declared using `let`. - */ - function testForInOfLoop(node) { - if (node.left && node.left.kind === 'let') { - context.report(node.left, msg); - } - } - - return { - 'ForStatement': testForLoop, - 'ForInStatement': testForInOfLoop, - 'ForOfStatement': testForInOfLoop - }; - } -};