Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining default to named conversions in ui/public #11323

Merged
merged 4 commits into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Final removal of all export default in ui/public
And turned on the eslint rule for that folder.
  • Loading branch information
stacey-gammon committed Apr 19, 2017
commit f9e23e071c21f29d9ecaed55fc66ac6a2c32d327
3 changes: 2 additions & 1 deletion src/core_plugins/timelion/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ require('./vis');
SavedObjectRegistryProvider.register(require('plugins/timelion/services/saved_sheet_register'));

// TODO: Expose an api for dismissing notifications
const unsafeNotifications = require('ui/notify').default._notifs;
import { notify } from 'ui/notify';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we okay with middle-of-the-file imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to the top!

const unsafeNotifications = notify._notifs;

require('ui/routes').enable();

Expand Down
4 changes: 4 additions & 0 deletions src/ui/public/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
plugins: [
'@elastic/kibana-custom'
]
rules:
no-console: 2
kibana-custom/no-default-export: error
3 changes: 0 additions & 3 deletions src/ui/public/agg_types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,3 @@ export function AggTypesIndexProvider(Private) {
});
}

export default AggTypesIndexProvider;

// preload
4 changes: 2 additions & 2 deletions src/ui/public/chrome/directives/kbn_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getUnhashableStatesProvider,
unhashUrl,
} from 'ui/state_management/state_hashing';
import Notifier from 'ui/notify';
import { notify } from 'ui/notify';

export function kbnChromeProvider(chrome, internals) {

Expand Down Expand Up @@ -56,7 +56,7 @@ export function kbnChromeProvider(chrome, internals) {

// and some local values
chrome.httpActive = $http.pendingRequests;
$scope.notifList = Notifier._notifs;
$scope.notifList = notify._notifs;

return chrome;
}
Expand Down
2 changes: 0 additions & 2 deletions src/ui/public/doc_title/doc_title.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,3 @@ export function DocTitleProvider(docTitle) {
return docTitle;
}

// Default export used in x-pack. TODO: cleanup.
export default DocTitleProvider;
2 changes: 0 additions & 2 deletions src/ui/public/filter_bar/filter_bar_click_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@ export function FilterBarClickHandlerProvider(Notifier) {
};
}

// Used in xpack. TODO: remove and cleanup.
export default FilterBarClickHandlerProvider;
1 change: 0 additions & 1 deletion src/ui/public/filter_bar/query_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,4 +384,3 @@ export function FilterBarQueryFilterProvider(Private, $rootScope, getAppState, g
}
}

export default FilterBarQueryFilterProvider;
1 change: 0 additions & 1 deletion src/ui/public/filter_manager/filter_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,4 @@ export function FilterManagerProvider(Private) {
return filterManager;
}

export default FilterManagerProvider;

1 change: 0 additions & 1 deletion src/ui/public/index_patterns/index_patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ export function IndexPatternsProvider(esAdmin, Notifier, Private, Promise, kbnIn

module.service('indexPatterns', Private => Private(IndexPatternsProvider));

export default IndexPatternsProvider;
2 changes: 0 additions & 2 deletions src/ui/public/management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ management.register('kibana', {
order: 20,
});

// Default export style used in x-pack. TODO: convert to named and remove.
export default management;
2 changes: 0 additions & 2 deletions src/ui/public/notify/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,5 +662,3 @@ function createGroupLogger(type, opts) {
};
}

// Used in x-pack. TODO: convert to named and remove.
export default Notifier;
2 changes: 0 additions & 2 deletions src/ui/public/notify/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,3 @@ if (window.addEventListener) {
});
}

// Used in x-pack. TODO: convert to named and remove.
export default notify;
2 changes: 0 additions & 2 deletions src/ui/public/registry/chrome_nav_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ export const chromeNavControlsRegistry = uiRegistry({
order: ['order']
});

// Used in x-pack. TODO: use named version and remove.
export default chromeNavControlsRegistry;
1 change: 0 additions & 1 deletion src/ui/public/registry/dev_tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ export const DevToolsRegistryProvider = uiRegistry({
order: ['order']
});

export default DevToolsRegistryProvider;
1 change: 0 additions & 1 deletion src/ui/public/registry/navbar_extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export const NavBarExtensionsRegistryProvider = uiRegistry({
order: ['order']
});

export default NavBarExtensionsRegistryProvider;
2 changes: 0 additions & 2 deletions src/ui/public/registry/vis_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ export const VisTypesRegistryProvider = uiRegistry({
index: ['name'],
order: ['title']
});

export default VisTypesRegistryProvider;
2 changes: 0 additions & 2 deletions src/ui/public/saved_objects/saved_object_registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ export const SavedObjectRegistryProvider = uiRegistry({
index: ['loaderProperties.name'],
order: ['loaderProperties.name']
});

export default SavedObjectRegistryProvider;
1 change: 0 additions & 1 deletion src/ui/public/template_vis_type/template_vis_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ export function TemplateVisTypeProvider(Private) {
return TemplateVisType;
}

export default TemplateVisTypeProvider;
2 changes: 0 additions & 2 deletions src/ui/public/time_buckets/calc_es_interval.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ export function TimeBucketsCalcEsIntervalProvider() {

return esDuration;
}

export default TimeBucketsCalcEsIntervalProvider;
1 change: 0 additions & 1 deletion src/ui/public/time_buckets/time_buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,3 @@ export function TimeBucketsProvider(Private, timefilter, config) {
return TimeBuckets;
}

export default TimeBucketsProvider;
2 changes: 1 addition & 1 deletion src/ui/public/utils/lodash-mixins/collection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (_) {
export function lodashCollectionMixin(_) {
_.mixin(_, {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/utils/lodash-mixins/function.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (_) {
export function lodashFunctionMixin(_) {
_.mixin({

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/utils/lodash-mixins/lang.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (_) {
export function lodashLangMixin(_) {
_.mixin(_, {


Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/utils/lodash-mixins/object.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (_) {
export function lodashObjectMixin(_) {
return _.mixin(_, {

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/utils/lodash-mixins/oop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (_) {
export function lodashOopMixin(_) {

// create a property descriptor for properties
// that won't change
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/utils/lodash-mixins/string.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function (_) {
export function lodashStringMixin(_) {

const DOT_PREFIX_RE = /(.).+?\./g;

Expand Down
2 changes: 0 additions & 2 deletions src/ui/public/utils/parse_interval.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ export function parseInterval(interval) {
return null;
}
}

export default parseInterval;
1 change: 0 additions & 1 deletion src/ui/public/utils/scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ Scanner.prototype.scanAndMap = function (searchString, options, mapFn) {
});
};

export default Scanner;
1 change: 0 additions & 1 deletion src/ui/public/vis/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ export function VisSchemasProvider(Private) {
return Schemas;
}

export default VisSchemasProvider;
22 changes: 15 additions & 7 deletions webpackShims/lodash.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
* var _ = require('lodash');
*/

var _ = require('node_modules/lodash/index.js').runInContext();
require('ui/utils/lodash-mixins/string')(_);
require('ui/utils/lodash-mixins/lang')(_);
require('ui/utils/lodash-mixins/object')(_);
require('ui/utils/lodash-mixins/collection')(_);
require('ui/utils/lodash-mixins/function')(_);
require('ui/utils/lodash-mixins/oop')(_);
const _ = require('node_modules/lodash/index.js').runInContext();
const { lodashStringMixin } = require('ui/utils/lodash-mixins/string');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these become imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this file is excluded from the babel transformation so if I make them imports, I get errors:

  ERROR in ./webpackShims/lodash.js
    Module parse failed: /Users/staceygammon/Elastic/kibana/webpackShims/lodash.js Line 10: Unexpected token
    You may need an appropriate loader to handle this file type.

const { lodashLangMixin } = require('ui/utils/lodash-mixins/lang');
const { lodashObjectMixin } = require('ui/utils/lodash-mixins/object');
const { lodashCollectionMixin } = require('ui/utils/lodash-mixins/collection');
const { lodashFunctionMixin } = require('ui/utils/lodash-mixins/function');
const { lodashOopMixin } = require('ui/utils/lodash-mixins/oop');

lodashStringMixin(_);
lodashLangMixin(_);
lodashObjectMixin(_);
lodashCollectionMixin(_);
lodashFunctionMixin(_);
lodashOopMixin(_);

module.exports = _;