Skip to content

Commit

Permalink
[internal] Replace let with const in root of ui/public
Browse files Browse the repository at this point in the history
This change was applied only to files in the root of the src/ui/public
directory.

All instances of `let` were replaced with `const`, and then any instance
that flagged the `no-const-assign` rule in the linter was put back.
  • Loading branch information
epixa committed Apr 12, 2016
1 parent 469c0bd commit 3ae0909
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/ui/public/bound_to_config_obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export default function BoundToConfigObjProvider($rootScope, config) {
* @return {Object}
*/
function BoundToConfigObj(input) {
let self = this;
const self = this;

_.forOwn(input, function (val, prop) {
if (!_.isString(val) || val.charAt(0) !== '=') {
self[prop] = val;
return;
}

let configKey = val.substr(1);
const configKey = val.substr(1);

update();
$rootScope.$on('init:config', update);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/compile_recursive_directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ uiModules
}

// Break the recursion loop by removing the contents
let contents = element.contents().remove();
const contents = element.contents().remove();
let compiledContents;
return {
pre: (link && link.pre) ? link.pre : null,
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/elastic_textarea.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';
import uiModules from 'ui/modules';
let NL_RE = /\n/g;
let events = 'keydown keypress keyup change';
const NL_RE = /\n/g;
const events = 'keydown keypress keyup change';

uiModules.get('kibana')
.directive('elasticTextarea', function () {
Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/errors.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import _ from 'lodash';
import angular from 'angular';

let canStack = (function () {
let err = new Error();
const canStack = (function () {
const err = new Error();
return !!err.stack;
}());

let errors = {};
const errors = {};

// abstract error class
function KbnError(msg, constructor) {
Expand Down Expand Up @@ -165,7 +165,7 @@ _.class(errors.DuplicateField).inherits(KbnError);
errors.SavedObjectNotFound = function SavedObjectNotFound(type, id) {
this.savedObjectType = type;
this.savedObjectId = id;
let idMsg = id ? ' (id: ' + id + ')' : '';
const idMsg = id ? ' (id: ' + id + ')' : '';
KbnError.call(this,
'Could not locate that ' + type + idMsg,
errors.SavedObjectNotFound);
Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Notifier from 'ui/notify/notifier';
import SimpleEmitter from 'ui/utils/simple_emitter';

export default function EventsProvider(Private, Promise) {
let notify = new Notifier({ location: 'EventEmitter' });
const notify = new Notifier({ location: 'EventEmitter' });

_.class(Events).inherits(SimpleEmitter);
function Events() {
Expand All @@ -23,7 +23,7 @@ export default function EventsProvider(Private, Promise) {
this._listeners[name] = [];
}

let listener = {
const listener = {
handler: handler
};
this._listeners[name].push(listener);
Expand Down Expand Up @@ -75,8 +75,8 @@ export default function EventsProvider(Private, Promise) {
* @returns {Promise}
*/
Events.prototype.emit = function (name) {
let self = this;
let args = _.rest(arguments);
const self = this;
const args = _.rest(arguments);

if (!self._listeners[name]) {
return self._emitChain;
Expand Down
16 changes: 8 additions & 8 deletions src/ui/public/fixed_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import $ from 'jquery';
import _ from 'lodash';
import uiModules from 'ui/modules';

let SCROLLER_HEIGHT = 20;
const SCROLLER_HEIGHT = 20;

uiModules
.get('kibana')
Expand Down Expand Up @@ -74,15 +74,15 @@ uiModules
function setup() {
cleanUp();

let containerWidth = $el.width();
let contentWidth = $el.prop('scrollWidth');
let containerHorizOverflow = contentWidth - containerWidth;
const containerWidth = $el.width();
const contentWidth = $el.prop('scrollWidth');
const containerHorizOverflow = contentWidth - containerWidth;

let elTop = $el.offset().top - $window.scrollTop();
let elBottom = elTop + $el.height();
let windowVertOverflow = elBottom - $window.height();
const elTop = $el.offset().top - $window.scrollTop();
const elBottom = elTop + $el.height();
const windowVertOverflow = elBottom - $window.height();

let requireScroller = containerHorizOverflow > 0 && windowVertOverflow > 0;
const requireScroller = containerHorizOverflow > 0 && windowVertOverflow > 0;
if (!requireScroller) return;

// push the content away from the scroller
Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ import _ from 'lodash';
* "kibana" module's injector.
*
*/
let existingModules = {};
let links = [];
const existingModules = {};
const links = [];

/**
* Take an angular module and extends the dependencies for that module to include all of the modules
Expand Down Expand Up @@ -102,13 +102,13 @@ function get(moduleName, requires) {
}

function close(moduleName) {
let module = existingModules[moduleName];
const module = existingModules[moduleName];

// already closed
if (!module) return;

// if the module is currently linked, unlink it
let i = links.indexOf(module);
const i = links.indexOf(module);
if (i > -1) links.splice(i, 1);

// remove from linked modules list of required modules
Expand Down

0 comments on commit 3ae0909

Please sign in to comment.