import()
as a function.JSHint doesn't recognize
import("module/path.mjs") //Returns Promise of export object
as a function and throws E053 and E021.
This function is used in importing modules for scripts doesn't end with ".mjs".
More info about can be seen in this MDN page.
I don't know if this function is in proposals, it just works in major browsers (Firefox,Chrome, etc.) and node.js.
Not using .jshintrc file, using a global extension setting.
{
"jshint.lintHTML": true,
"jshint.options": {
"esversion": 9,
"varstmt": true,
"unused": true,
"undef": true,
"singleGroups": true,
"eqeqeq": true,
"freeze": true,
"lastsemic": true,
"leanswitch": true,
"latedef": true,
"maxdepth": 4,
"noreturnawait": true,
"nonbsp": true,
"noarg": true,
"maxparams": 3,
"maxerr": 10,
"maxcomplexity": 15,
"node": true
}
}
Thanks for the report! We haven't implemented support for dynamic imports, but we plan to (it definitely satisfies our policy on new language features). That makes this more of a feature request than a bug report, so I've modified the issue's title a bit--hope you don't mind.
If you (or anyone else) would like to try implementing this, then I'd gladly give guidance!
@jugglinmike Considering this is an es2020 proposal, how would you envision somone be able to toggle this feature? I'm assuming there would be an esversion: 11
which I assume would require all of the other es2020 proposals (nullish coalescing, optional chaining, etc...) to be supported as well.
I may look into implementing support for this specific proposal as it would help up quite a bit.
esversion: 11
sounds about right to me, @almercier! Implementing all of the new language features is a big undertaking, and I wouldn't expect anyone to take all of that on by themselves. If you wanted to focus on the import
expression, then we could tackle the other features in parallel (or publish a release with partial support for the new language edition).
I've updated our submodule for Test262 so that we have better coverage for the new language features. I've also created a tracking branch for a new minor release; that's where we should land new features.
JSHint version 2.13.0, released today, includes support for dynamic imports. Be sure to update your configuration to opt in to the new language feature via esversion: 11
or later.
Most helpful comment
Thanks for the report! We haven't implemented support for dynamic imports, but we plan to (it definitely satisfies our policy on new language features). That makes this more of a feature request than a bug report, so I've modified the issue's title a bit--hope you don't mind.
If you (or anyone else) would like to try implementing this, then I'd gladly give guidance!