Skip to content

Commit

Permalink
[internal] Replace var with let in root of ui
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
directory.

This was an automatic replacement from var to let for any variable
declaration that doubles as the initial assignment. Ultimately we want
most of these to be converted to const, but that can happen in a future
commit.

For example:

`var foo = 'bar';` becomes `let foo = 'var';`

This was accomplished by replacing:
find: `var ([a-zA-Z_$][0-9a-zA-Z_$]*)(\s+)=`
replace: `let $1$2=`
  • Loading branch information
epixa committed Apr 12, 2016
1 parent 2f3cdf6 commit a6ed127
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/ui/ui_bundle_collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class UiBundleCollection {
case 1:
return `bundle for ${this.each[0].id}`;
default:
var ids = this.getIds();
var last = ids.pop();
var commas = ids.join(', ');
let ids = this.getIds();
let last = ids.pop();
let commas = ids.join(', ');
return `bundles for ${commas} and ${last}`;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ui_bundler_env.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ module.exports = class UiBundlerEnv {
let owner = pluginId ? `Plugin ${pluginId}` : 'Kibana Server';

// TODO(spalger): we could do a lot more to detect colliding module defs
var existingOwner = this.aliasOwners[id] || this.aliasOwners[`${id}$`];
let existingOwner = this.aliasOwners[id] || this.aliasOwners[`${id}$`];

if (existingOwner) {
throw new TypeError(`${owner} attempted to override export "${id}" from ${existingOwner}`);
Expand Down
10 changes: 5 additions & 5 deletions src/ui/ui_exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class UiExports {
consumePlugin(plugin) {
plugin.apps = new UiAppCollection(this);

var types = _.keys(plugin.uiExportsSpecs);
let types = _.keys(plugin.uiExportsSpecs);
if (!types) return false;

var unkown = _.reject(types, this.exportConsumer, this);
let unkown = _.reject(types, this.exportConsumer, this);
if (unkown.length) {
throw new Error('unknown export types ' + unkown.join(', ') + ' in plugin ' + plugin.id);
}
Expand Down Expand Up @@ -110,9 +110,9 @@ class UiExports {
}

find(patterns) {
var aliases = this.aliases;
var names = _.keys(aliases);
var matcher = _.partialRight(minimatch.filter, { matchBase: true });
let aliases = this.aliases;
let names = _.keys(aliases);
let matcher = _.partialRight(minimatch.filter, { matchBase: true });

return _.chain(patterns)
.map(function (pattern) {
Expand Down

0 comments on commit a6ed127

Please sign in to comment.