I’m migrating my codebase from Meteor 1.2 to Meteor 1.3 and in the progress of rewriting all my global variables to nice import statements.
This seems like a very cumbersome process as my IDE (WebStorm) does not automatically recognizes the import paths for Meteor packages. I have to lookup and write basically everything myself.
Is there a quicker/automated process to do this? Surely I can’t be the only one who’s rewriting global variables to import statements for Meteor 1.3.
I use the latest version of WebStorm on Mac and I have set my ecmascript version correctly.
When I type for example the keyword “Meteor” without having imported it, and I highlight the keyword Meteor, WebStorm does not give any suggestions for what to import. Not sure why
@timw it turns out webstorm does offer automatic imports.
If it cannot resolve a symbol within the file itself and is exported somewhere else, there is a red lightbulb that appears at the beginning of he file with a caret and when you click on it, you’ll see it offering possible imports!
This does not currently work for JSX components, but it is a bug and is on the roadmap for a fix!
I know this is how it works when I have filea.js and fileb.js in the same project, and I try to import a variable from filea.js into fileb.js.
However, this is not how it works for meteor packages. For example, when I write “FlowRouter” in a file, WebStorm does not suggest me to import it from the flow router package. Is there a workaround for this or do I simply wait until this is improved in WebStorm?
Hmm yeah that’s right, meteor packages don’t actually get recognized for import suggestions. Did you post a feature request, even perhaps labeling it a bug report, over at the webstorm tracker? https://youtrack.jetbrains.com/oauth?state=%2F