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

Parsing Error with dynamic imports #232

Closed
epiqueras opened this issue Jun 20, 2017 · 8 comments
Closed

Parsing Error with dynamic imports #232

epiqueras opened this issue Jun 20, 2017 · 8 comments

Comments

@epiqueras
Copy link

I have:

// xo
"esnext": true,

and I still get a parsing error with import(....

Adding the parser explicitly in xo config ("parser": "babel-eslint") doesn't help either.

@sindresorhus
Copy link
Member

I'm not sure import() is even supported by Babel yet. It's a very new feature. Not really relevant here. You have to make sure the parser supports it.

@epiqueras
Copy link
Author

esnext: true sets the parser to babel-eslint right?

I'm pretty sure babel-eslint supports import()

@kevva
Copy link
Contributor

kevva commented Jun 20, 2017

esnext: true only adds the rules in https://github.com/sindresorhus/eslint-config-xo/blob/master/esnext.js. Setting the parser to babel-eslint should work though since babel-eslint supports dynamic imports.

@epiqueras
Copy link
Author

@kevva I set the parser and it still fails

@kevva
Copy link
Contributor

kevva commented Jun 20, 2017

And you have installed it I presume?

@epiqueras
Copy link
Author

@kevva yes.

@kevva
Copy link
Contributor

kevva commented Jun 20, 2017

Works fine for me:

// x.js
'use strict';
import('y.js').then(m => {
    console.log(m);
});
// package.json
{
  "dependencies": {
    "babel-eslint": "^7.2.3",
    "xo": "^0.18.2"
  },
  "xo": {
    "parser": "babel-eslint"
  }
}

@epiqueras
Copy link
Author

Oops,

The babel-eslint readme showed babel-eslint@6 as the install. Upgraded to the newest version and it works fine now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants