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

Support ES6 modules (import+export declarations) #35

Closed
cvrebert opened this issue Jan 19, 2015 · 21 comments
Closed

Support ES6 modules (import+export declarations) #35

cvrebert opened this issue Jan 19, 2015 · 21 comments

Comments

@cvrebert
Copy link

Refs #10. Esprima harmony already supports this.

@mlegenhausen
Copy link

+1

@nzakas
Copy link
Member

nzakas commented Jan 19, 2015

ES6 progress is being tracked here: #10

@nzakas
Copy link
Member

nzakas commented Jan 19, 2015

Oops, hit enter too soon. We will be adding each ES6 feature from Esprima piece by piece. Module will likely be last unless someone submits a PR.

@cvrebert
Copy link
Author

Well, there's not even a bullet point for it in #10's checklist currently.

@nzakas
Copy link
Member

nzakas commented Jan 19, 2015

Thanks, I just added it.

@caridy
Copy link
Contributor

caridy commented Jan 23, 2015

@nzakas I can probably take care of the modules grammar as I did for esprima a while ago.

@Flickdm
Copy link

Flickdm commented Jan 23, 2015

image

@rjhilgefort
Copy link

👍

1 similar comment
@rosshadden
Copy link

👍

@cvrebert
Copy link
Author

😍

@nzakas
Copy link
Member

nzakas commented Jan 23, 2015

@caridy awesome, we'd appreciate the contribution.

@caridy
Copy link
Contributor

caridy commented Jan 26, 2015

ok, I got a chance to put some time on this last night, and a questions arise:

In esprima, we introduced {sourceType: "module"}, which defines extra.isModule flag to signal to esprima that is should enforce strict mode, and should enable export/import declarations.

In espree, it seems that extra.ecmaFeatures.<something> will be the way to switch modules on. The problem is that enabling modules implies enabling other features as per the modules' grammar, e.g.: import let foo = 1;, which requires blockBindings to be available. Is there a provision to define dependencies between features? My proposal will be to add a provision similar to {sourceType: "module"}, which will flip multiple features under extra.ecmaFeatures, in this case, modules and blockBindings, and eventually classes.

@nzakas
Copy link
Member

nzakas commented Jan 27, 2015

I think having sourceType: "module" is the right choice, both for Esprima compatibility and also because I don't like the idea of ecmaFeatures having dependencies on one another.

So +1 to your proposal.

caridy added a commit to caridy/espree that referenced this issue Jan 27, 2015
* import grammar
* export grammar
* option scriptType=module
@MoOx
Copy link

MoOx commented Feb 19, 2015

Interested too by import/export support in espree :)

@naholyr
Copy link

naholyr commented Feb 20, 2015

👍

caridy added a commit to caridy/espree that referenced this issue Feb 20, 2015
@jozanza
Copy link

jozanza commented Feb 20, 2015

👍 This is awesome. When can we expect it to get published to npm?

@nzakas
Copy link
Member

nzakas commented Feb 20, 2015

When the work has been done. :)

I appreciate everyone's enthusiasm, but there's no need for additional +1ing. We're doing our best to get this done and this issue will be closed when the work is complete.

@naholyr
Copy link

naholyr commented Feb 21, 2015

You're awesome <3

@ai
Copy link

ai commented Mar 3, 2015

Does eslint-babel can help in this issue?

@douglasduteil
Copy link

+1

@nzakas nzakas closed this as completed in 055f201 Mar 5, 2015
nzakas added a commit that referenced this issue Mar 5, 2015
fixes #35: adds module import and export grammar
@kentcdodds
Copy link

@ai, eslint-babel doesn't support it properly either. Given:

import foo as 'foo';

foo.bar();

currently results in:

3:1  error  'foo' is not defined                              no-undef

@eslint eslint locked and limited conversation to collaborators Mar 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests