[internal] Replace let with const in root of ui/public

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.
This commit is contained in:
Court Ewing 2016-04-12 17:45:32 -04:00
parent 469c0bde04
commit 3ae090908d
7 changed files with 25 additions and 25 deletions

View file

@ -16,7 +16,7 @@ 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) !== '=') {
@ -24,7 +24,7 @@ export default function BoundToConfigObjProvider($rootScope, config) {
return;
}
let configKey = val.substr(1);
const configKey = val.substr(1);
update();
$rootScope.$on('init:config', update);

View file

@ -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,

View file

@ -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 () {

View file

@ -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) {
@ -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);

View file

@ -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() {
@ -23,7 +23,7 @@ export default function EventsProvider(Private, Promise) {
this._listeners[name] = [];
}
let listener = {
const listener = {
handler: handler
};
this._listeners[name].push(listener);
@ -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;

View file

@ -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')
@ -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

View file

@ -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
@ -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