-
Notifications
You must be signed in to change notification settings - Fork 8.5k
export default problems #6258
Copy link
Copy link
Closed
Labels
Team:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//choredev
Description
I've found some potential bugs that works with Babel 5, but correctly breaks with Babel 6.
module.exports and exports default are different in some important ways, e.g. that this isn't allowed:
// foo.js
export default { baz: 42, bar: false }
// bar.js
import { baz } from './foo'Instead it should be:
export const baz = 42;
export const bar = false;I see we export an object several places:
$ find ./src -name "*.js" | xargs grep -l "export default {"
./src/cli/plugin/plugin_installer.js
./src/fixtures/field_mapping.js
./src/fixtures/filter_skeleton.js
./src/fixtures/mapping_with_dupes.js
./src/fixtures/mock_ui_state.js
./src/fixtures/search_response.js
./src/plugins/kibana/public/discover/components/field_chooser/lib/field_calculator.js
./src/plugins/kibana/public/settings/saved_object_registry.js
./src/ui/public/modules.js
./src/ui/public/utils/date_range.js
./src/ui/public/utils/dateMath.js
./src/ui/public/utils/key_map.js
./src/ui/public/utils/sequencer.js
./src/ui/public/utils/supports.jsWe should probably go through these exports and fix them. We might need smarter search too, in order to catch things like:
// foo.js
const obj = { baz: 42, bar: false };
export default obj;
// bar.js
import { baz } from './foo'Might be possible to use jscodeshift, jsfmt or something else to search for it (or just upgrade and see where it breaks 🙈)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Team:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//choredev
Type
Fields
Give feedbackNo fields configured for issues without a type.