From de20762889a72c060e46b5e7042320c71e44ad92 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 1 Apr 2016 14:21:55 -0400 Subject: [PATCH] [internal] Remove all variable redeclarations Redeclaring variables causes ambiguity and serves no purpose. It actually causes a runtime error when you do it with `let`, and we can enforce not doing it via a linter rule. --- src/ui/public/agg_types/buckets/range.js | 2 +- src/ui/public/visualize/visualize_legend.js | 2 +- test/fixtures/scenario_manager.js | 1 - test/functional/apps/discover/index.js | 1 - test/functional/apps/visualize/index.js | 1 - test/support/pages/common.js | 2 +- 6 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/ui/public/agg_types/buckets/range.js b/src/ui/public/agg_types/buckets/range.js index 7bddefcf02513..bc57b997774de 100644 --- a/src/ui/public/agg_types/buckets/range.js +++ b/src/ui/public/agg_types/buckets/range.js @@ -30,7 +30,7 @@ export default function RangeAggDefinition(Private) { var id = RangeKey.idBucket(bucket); - var key = keys.get(id); + key = keys.get(id); if (!key) { key = new RangeKey(bucket); keys.set(id, key); diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index bd2cbe281ec3c..36cd344bd89e3 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -90,7 +90,7 @@ uiModules.get('kibana') // Most of these functions were moved directly from the old Legend class. Not a fan of this. function getLabels(data, type) { if (!data) return []; - var data = data.columns || data.rows || [data]; + data = data.columns || data.rows || [data]; if (type === 'pie') return Data.prototype.pieNames(data); return getSeriesLabels(data); }; diff --git a/test/fixtures/scenario_manager.js b/test/fixtures/scenario_manager.js index 4190d9de6ac7e..a1822a349749e 100644 --- a/test/fixtures/scenario_manager.js +++ b/test/fixtures/scenario_manager.js @@ -123,7 +123,6 @@ ScenarioManager.prototype.loadIfEmpty = function (id) { var scenario = config[id]; if (!scenario) throw new Error('No scenario found for ' + id); - var self = this; return Promise.all(scenario.bulk.map(function mapBulk(bulk) { var loadIndexDefinition; diff --git a/test/functional/apps/discover/index.js b/test/functional/apps/discover/index.js index c81f441ba4d0d..9fbebd059f08b 100644 --- a/test/functional/apps/discover/index.js +++ b/test/functional/apps/discover/index.js @@ -9,7 +9,6 @@ define(function (require) { var collapseExpand = require('./_collapse_expand'); bdd.describe('discover app', function () { - var scenarioManager; var remote; var scenarioManager = new ScenarioManager(url.format(config.servers.elasticsearch)); this.timeout = config.timeouts.default; diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js index 4492d165c3af4..21ecf1777a3e8 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -20,7 +20,6 @@ define(function (require) { bdd.describe('visualize app', function () { var common; - var scenarioManager; var remote; var headerPage; var settingsPage; diff --git a/test/support/pages/common.js b/test/support/pages/common.js index c5f2ce37aa312..bb8faaa970887 100644 --- a/test/support/pages/common.js +++ b/test/support/pages/common.js @@ -91,7 +91,7 @@ define(function (require) { return self.remote.getCurrentUrl(); }) .then(function (currentUrl) { - var currentUrl = currentUrl.replace(/\/\/\w+:\w+@/, '//'); + currentUrl = currentUrl.replace(/\/\/\w+:\w+@/, '//'); var navSuccessful = new RegExp(appUrl).test(currentUrl); if (!navSuccessful) { var msg = 'App failed to load: ' + appName +