Skip to content

Commit

Permalink
Backport PR #6653
Browse files Browse the repository at this point in the history
---------

**Commit 1:**
[internal] Replace empty var declaration with let

Any time there is a variable defined in a JS file without also storing a
value in it, we know that definition cannot be converted to a const, so
we convert it to a let.

For example:

`var blah;` becomes `let blah;`

Some of these things variables might be unused, and many others can
likely be switched to const with only minor refactoring, but the commit
is very large, so there are no changes in it other than the 1:1 switch.

* Original sha: bfc59e9
* Authored by Court Ewing <court@epixa.com> on 2016-03-24T22:27:29Z
  • Loading branch information
epixa committed Mar 28, 2016
1 parent bf941af commit ba96449
Show file tree
Hide file tree
Showing 183 changed files with 2,822 additions and 0 deletions.
24 changes: 24 additions & 0 deletions backport.rej.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Backport of PR [#6653](https://github.com/elastic/kibana/pull/6653) to branch 4.x failed

60 file could not be found in this branch,
182 patch failed to apply,
while 30 patch applied successfully.

The following script will rebase the commits that need to be backported onto
this backport branch. Resolve any conflicts as you normally would in a rebase.
You do *not* need to remove these backport.rej files, and you can add
additional commits if that's necessary.

```
sh begin-backport.rej
```

Once the conficts are resolved on your local backport branch, the following
script will remove the remnants of this backport commit and squash the newly
resolved commits (and any others you may have added) into a single backport
commit with the proper commit message. Finally, it'll replace the upstream
backport branch (the one from the backport PR) with the result.

```
sh finish-backport.rej
```
12 changes: 12 additions & 0 deletions src/server/status/__tests__/status.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff a/src/server/status/__tests__/status.js b/src/server/status/__tests__/status.js (rejected hunks)
@@ -4,8 +4,8 @@ import Status from '../status';
import ServerStatus from '../server_status';

describe('Status class', function () {
- var server;
- var serverStatus;
+ let server;
+ let serverStatus;

beforeEach(function () {
server = { expose: sinon.stub(), log: sinon.stub() };
10 changes: 10 additions & 0 deletions src/ui/public/Binder/__tests__/binder.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/binder/__tests__/binder.js b/src/ui/public/binder/__tests__/binder.js (rejected hunks)
@@ -6,7 +6,7 @@ import Binder from 'ui/binder';
import $ from 'jquery';

describe('Binder class', function () {
- var $scope;
+ let $scope;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function ($rootScope) {
10 changes: 10 additions & 0 deletions src/ui/public/Vis/__tests__/_renderbot.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/vis/__tests__/_renderbot.js b/src/ui/public/vis/__tests__/_renderbot.js (rejected hunks)
@@ -2,7 +2,7 @@ import expect from 'expect.js';
import ngMock from 'ng_mock';
import VisRenderbotProvider from 'ui/vis/renderbot';
describe('renderbot', function () {
- var Renderbot;
+ let Renderbot;

function init() {
ngMock.module('kibana');
17 changes: 17 additions & 0 deletions src/ui/public/Vis/__tests__/_vis.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff a/src/ui/public/vis/__tests__/_vis.js b/src/ui/public/vis/__tests__/_vis.js (rejected hunks)
@@ -7,11 +7,11 @@ import RegistryVisTypesProvider from 'ui/registry/vis_types';
describe('Vis Class', function () {


- var indexPattern;
- var Vis;
- var visTypes;
+ let indexPattern;
+ let Vis;
+ let visTypes;

- var vis;
+ let vis;
var stateFixture = {
type: 'pie',
aggs: [
18 changes: 18 additions & 0 deletions src/ui/public/agg_response/geo_json/__tests__/geo_json.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff a/src/ui/public/agg_response/geo_json/__tests__/geo_json.js b/src/ui/public/agg_response/geo_json/__tests__/geo_json.js (rejected hunks)
@@ -9,11 +9,11 @@ import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
import AggResponseGeoJsonGeoJsonProvider from 'ui/agg_response/geo_json/geo_json';

describe('GeoJson Agg Response Converter', function () {
- var vis;
- var tabify;
- var convert;
- var esResponse;
- var aggs;
+ let vis;
+ let tabify;
+ let convert;
+ let esResponse;
+ let aggs;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff a/src/ui/public/agg_response/hierarchical/__tests__/build_hierarchical_data.js b/src/ui/public/agg_response/hierarchical/__tests__/build_hierarchical_data.js (rejected hunks)
@@ -9,11 +9,11 @@ import VisAggConfigsProvider from 'ui/vis/agg_configs';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import AggResponseHierarchicalBuildHierarchicalDataProvider from 'ui/agg_response/hierarchical/build_hierarchical_data';

-var Vis;
-var Notifier;
-var AggConfigs;
-var indexPattern;
-var buildHierarchicalData;
+let Vis;
+let Notifier;
+let AggConfigs;
+let indexPattern;
+let buildHierarchicalData;

describe('buildHierarchicalData', function () {

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/hierarchical/__tests__/collect_branch.js b/src/ui/public/agg_response/hierarchical/__tests__/collect_branch.js (rejected hunks)
@@ -3,7 +3,7 @@ import _ from 'lodash';
import collectBranch from 'ui/agg_response/hierarchical/_collect_branch';
import expect from 'expect.js';
describe('collectBranch()', function () {
- var results;
+ let results;
var convert = function (name) {
return 'converted:' + name;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff a/src/ui/public/agg_response/hierarchical/__tests__/create_raw_data.js b/src/ui/public/agg_response/hierarchical/__tests__/create_raw_data.js (rejected hunks)
@@ -9,14 +9,14 @@ import VisProvider from 'ui/vis';
import VisAggConfigsProvider from 'ui/vis/agg_configs';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';

-var AggConfigs;
-var Vis;
-var indexPattern;
+let AggConfigs;
+let Vis;
+let indexPattern;

describe('buildHierarchicalData()', function () {
describe('createRawData()', function () {
- var vis;
- var results;
+ let vis;
+ let results;

beforeEach(ngMock.module('kibana'));

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff a/src/ui/public/agg_response/hierarchical/__tests__/transform_aggregation.js b/src/ui/public/agg_response/hierarchical/__tests__/transform_aggregation.js (rejected hunks)
@@ -5,8 +5,8 @@ import AggResponseHierarchicalTransformAggregationProvider from 'ui/agg_response

describe('buildHierarchicalData()', function () {
describe('transformAggregation()', function () {
- var transform;
- var fixture;
+ let transform;
+ let fixture;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff a/src/ui/public/agg_response/hierarchical/_array_to_linked_list.js b/src/ui/public/agg_response/hierarchical/_array_to_linked_list.js (rejected hunks)
@@ -1,6 +1,6 @@
import _ from 'lodash';
export default function (buckets) {
- var previous;
+ let previous;
_.each(buckets, function (bucket) {
if (previous) {
bucket._previous = previous;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/hierarchical/_hierarchical_tooltip_formatter.js b/src/ui/public/agg_response/hierarchical/_hierarchical_tooltip_formatter.js (rejected hunks)
@@ -21,7 +21,7 @@ export default function HierarchicalTooltipFormaterProvider($rootScope, $compile
_.forEachRight($tooltipScope.rows, function (row, i, rows) {
row.spacer = $sce.trustAsHtml(_.repeat('&nbsp;', row.depth));

- var percent;
+ let percent;
if (row.item.percentOfGroup != null) {
percent = row.item.percentOfGroup;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_add_to_siri.js b/src/ui/public/agg_response/point_series/__tests__/_add_to_siri.js (rejected hunks)
@@ -2,7 +2,7 @@ import expect from 'expect.js';
import ngMock from 'ng_mock';
import AggResponsePointSeriesAddToSiriProvider from 'ui/agg_response/point_series/_add_to_siri';
describe('addToSiri', function () {
- var addToSiri;
+ let addToSiri;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_fake_x_aspect.js b/src/ui/public/agg_response/point_series/__tests__/_fake_x_aspect.js (rejected hunks)
@@ -6,11 +6,11 @@ import AggTypesAggTypeProvider from 'ui/agg_types/agg_type';
import AggResponsePointSeriesFakeXAspectProvider from 'ui/agg_response/point_series/_fake_x_aspect';
describe('makeFakeXAspect', function () {

- var makeFakeXAspect;
- var Vis;
- var AggType;
- var AggConfig;
- var indexPattern;
+ let makeFakeXAspect;
+ let Vis;
+ let AggType;
+ let AggConfig;
+ let indexPattern;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_get_aspects.js b/src/ui/public/agg_response/point_series/__tests__/_get_aspects.js (rejected hunks)
@@ -9,11 +9,11 @@ import AggResponsePointSeriesGetAspectsProvider from 'ui/agg_response/point_seri
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
describe('getAspects', function () {

- var Vis;
- var Table;
- var AggConfig;
- var indexPattern;
- var getAspects;
+ let Vis;
+ let Table;
+ let AggConfig;
+ let indexPattern;
+ let getAspects;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
@@ -24,8 +24,8 @@ describe('getAspects', function () {
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
}));

- var vis;
- var table;
+ let vis;
+ let table;

var date = _.memoize(function (n) {
return moment().startOf('day').add(n, 'hour').valueOf();
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_get_point.js b/src/ui/public/agg_response/point_series/__tests__/_get_point.js (rejected hunks)
@@ -5,7 +5,7 @@ import AggResponsePointSeriesGetPointProvider from 'ui/agg_response/point_series

describe('getPoint', function () {

- var getPoint;
+ let getPoint;

var truthFormatted = { fieldFormatter: _.constant(_.constant(true)) };
var identFormatted = { fieldFormatter: _.constant(_.identity) };
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_get_series.js b/src/ui/public/agg_response/point_series/__tests__/_get_series.js (rejected hunks)
@@ -3,7 +3,7 @@ import expect from 'expect.js';
import ngMock from 'ng_mock';
import AggResponsePointSeriesGetSeriesProvider from 'ui/agg_response/point_series/_get_series';
describe('getSeries', function () {
- var getSeries;
+ let getSeries;

var agg = { fieldFormatter: _.constant(_.identity) };

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_init_x_axis.js b/src/ui/public/agg_response/point_series/__tests__/_init_x_axis.js (rejected hunks)
@@ -4,7 +4,7 @@ import ngMock from 'ng_mock';
import AggResponsePointSeriesInitXAxisProvider from 'ui/agg_response/point_series/_init_x_axis';
describe('initXAxis', function () {

- var initXAxis;
+ let initXAxis;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_init_y_axis.js b/src/ui/public/agg_response/point_series/__tests__/_init_y_axis.js (rejected hunks)
@@ -4,7 +4,7 @@ import ngMock from 'ng_mock';
import AggResponsePointSeriesInitYAxisProvider from 'ui/agg_response/point_series/_init_y_axis';
describe('initYAxis', function () {

- var initYAxis;
+ let initYAxis;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
16 changes: 16 additions & 0 deletions src/ui/public/agg_response/point_series/__tests__/_main.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_main.js b/src/ui/public/agg_response/point_series/__tests__/_main.js (rejected hunks)
@@ -11,10 +11,10 @@ describe('pointSeriesChartDataFromTable', function () {
this.slow(1000);


- var pointSeriesChartDataFromTable;
- var indexPattern;
- var Table;
- var Vis;
+ let pointSeriesChartDataFromTable;
+ let indexPattern;
+ let Table;
+ let Vis;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/point_series/__tests__/_tooltip_formatter.js b/src/ui/public/agg_response/point_series/__tests__/_tooltip_formatter.js (rejected hunks)
@@ -5,7 +5,7 @@ import ngMock from 'ng_mock';
import AggResponsePointSeriesTooltipFormatterProvider from 'ui/agg_response/point_series/_tooltip_formatter';
describe('tooltipFormatter', function () {

- var tooltipFormatter;
+ let tooltipFormatter;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
10 changes: 10 additions & 0 deletions src/ui/public/agg_response/point_series/_get_series.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/point_series/_get_series.js b/src/ui/public/agg_response/point_series/_get_series.js (rejected hunks)
@@ -37,7 +37,7 @@ export default function PointSeriesGetSeries(Private) {
if (multiY) {
series = _.sortBy(series, function (siri) {
var firstVal = siri.values[0];
- var y;
+ let y;

if (firstVal) {
var agg = firstVal.aggConfigResult.aggConfig;
10 changes: 10 additions & 0 deletions src/ui/public/agg_response/tabify/__tests__/_buckets.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff a/src/ui/public/agg_response/tabify/__tests__/_buckets.js b/src/ui/public/agg_response/tabify/__tests__/_buckets.js (rejected hunks)
@@ -2,7 +2,7 @@ import expect from 'expect.js';
import ngMock from 'ng_mock';
import AggResponseTabifyBucketsProvider from 'ui/agg_response/tabify/_buckets';
describe('Buckets wrapper', function () {
- var Buckets;
+ let Buckets;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private, $injector) {
14 changes: 14 additions & 0 deletions src/ui/public/agg_response/tabify/__tests__/_get_columns.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff a/src/ui/public/agg_response/tabify/__tests__/_get_columns.js b/src/ui/public/agg_response/tabify/__tests__/_get_columns.js (rejected hunks)
@@ -4,9 +4,9 @@ import AggResponseTabifyGetColumnsProvider from 'ui/agg_response/tabify/_get_col
import VisProvider from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
describe('get columns', function () {
- var getColumns;
- var Vis;
- var indexPattern;
+ let getColumns;
+ let Vis;
+ let indexPattern;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private, $injector) {
16 changes: 16 additions & 0 deletions src/ui/public/agg_response/tabify/__tests__/_integration.js.rej
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff a/src/ui/public/agg_response/tabify/__tests__/_integration.js b/src/ui/public/agg_response/tabify/__tests__/_integration.js (rejected hunks)
@@ -7,10 +7,10 @@ import VisProvider from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
describe('tabifyAggResponse Integration', function () {

- var Vis;
- var Buckets;
- var indexPattern;
- var tabifyAggResponse;
+ let Vis;
+ let Buckets;
+ let indexPattern;
+ let tabifyAggResponse;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private, $injector) {
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff a/src/ui/public/agg_response/tabify/__tests__/_response_writer.js b/src/ui/public/agg_response/tabify/__tests__/_response_writer.js (rejected hunks)
@@ -10,14 +10,14 @@ import VisProvider from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
describe('ResponseWriter class', function () {

- var Vis;
- var Table;
- var Buckets;
- var Private;
- var TableGroup;
- var getColumns;
- var indexPattern;
- var ResponseWriter;
+ let Vis;
+ let Table;
+ let Buckets;
+ let Private;
+ let TableGroup;
+ let getColumns;
+ let indexPattern;
+ let ResponseWriter;

function defineSetup(stubGetColumns) {
beforeEach(ngMock.module('kibana'));
Loading

0 comments on commit ba96449

Please sign in to comment.