Destroying globals to ensure module imports work

In my current application I’m moving everything to ES2015 module imports. To ensure that they are working currectly, I’ve made a file in the lib folder for destroying globals, like:

Meteor = ""; sAlert = "";

Now Meteor and sAlert will only work properly in files after adding:

import { Meteor } from 'meteor/meteor';
import { sAlert } from 'meteor/juliancwirko:s-alert';

Is there a better way to do this to ensure that my entire project will work without “magical” globals. And is there an estimated time frame on when Meteor will go to this model strictly?

1 Like

The easiest way to ensure you aren’t using globals is to set up ESLint to complain about undefined variables: http://guide.meteor.com/code-style.html#eslint

2 Likes

To answer your other question: Meteor is not going to remove globals any time soon. What might happen is that the global variables can be turned off by removing a package that’s installed by default.

1 Like