From 4d65099f6787ae7a5c905ec69a47b0d3567d3488 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 2 Feb 2016 16:20:44 -0800 Subject: [PATCH 1/2] tools: fix redeclared vars in doc/json.js --- tools/doc/json.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/doc/json.js b/tools/doc/json.js index b507c5412e9257..299c8ed9fd84ad 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -184,14 +184,13 @@ function processList(section) { var type = tok.type; if (type === 'space') return; if (type === 'list_item_start') { + var n = {}; if (!current) { - var n = {}; values.push(n); current = n; } else { current.options = current.options || []; stack.push(current); - var n = {}; current.options.push(n); current = n; } @@ -478,14 +477,14 @@ function deepCopy(src, dest) { function deepCopy_(src) { if (!src) return src; if (Array.isArray(src)) { - var c = new Array(src.length); + const c = new Array(src.length); src.forEach(function(v, i) { c[i] = deepCopy_(v); }); return c; } if (typeof src === 'object') { - var c = {}; + const c = {}; Object.keys(src).forEach(function(k) { c[k] = deepCopy_(src[k]); }); From 31ffe5412e8029b4a228535c9afa54f85a5dd486 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 13 Jan 2016 16:14:28 -0800 Subject: [PATCH 2/2] tools: enable no-redeclare rule for linter --- .eslintrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.eslintrc b/.eslintrc index c02364e40f452a..5b95af8045f61e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -48,6 +48,8 @@ rules: # list: https://github.com/eslint/eslint/tree/master/docs/rules#best-practices ## require falls through comment on switch-case no-fallthrough: 2 + ## disallow declaring the same variable more than once + no-redeclare: 2 # Stylistic Issues # list: https://github.com/eslint/eslint/tree/master/docs/rules#stylistic-issues