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

fixes 1000: support ES6 import and export declarations #1149

Closed
wants to merge 1 commit into from

Conversation

caridy
Copy link
Contributor

@caridy caridy commented Mar 23, 2015

Bulk of the work porting import and export declaration from harmony (from espree actually) into the master branch.

notes:

  • ported pieces from ES6 module syntax update #287
  • ported pieces from fixes #35: adds module import and export grammar eslint/js#43
  • sourceType is a global setting that can be module, which enables import and export declarations. espree is more advanced since it actually turn other features on/off depending on that value, not so sure if esprima wants to have something like that. for now, I make it simple and very restrictive, feel free to refactor it.
  • function declarations, and class declarations can have id=null based on some previous discussions to support export default class {} and export default function () {}.
  • the hard part was the tests, having tests with the tree case specifying the sourceType was easy and simple, but having failures to be validated using sourceType="module" was a pain, I ended up creating a new type of case called module to support parsing in module mode but validating the failure. maybe someone can refactor that to make it more generic, maybe adding the type into the failure case when possible.

// covering:
// export {default}; // missing fromClause
throwError(lookahead.value ?
Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indented weirdly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's double tab for a multi-line statement ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, was looking on my phone. Missed it.

@mikesherov
Copy link
Member

@caridy looking great! I had a couple of small comments. Also, can you please sign the jQuery CLA? http://contribute.jquery.org/CLA/

@caridy caridy force-pushed the modules branch 2 times, most recently from 7c22c3f to 52b8969 Compare March 27, 2015 18:58
declaration = parseStatementListItem();
return node.finishExportNamedDeclaration(declaration, specifiers, null);
default:
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This default is unnecessary.

@ariya
Copy link
Contributor

ariya commented Apr 5, 2015

LGTM 👍

@caridy
Copy link
Contributor Author

caridy commented Apr 6, 2015

@mikesherov can you merge this? I'm about to go on vacation for 2 months, and I will like to get this clear before I go this weekend.

@mikesherov
Copy link
Member

@caridy, will do.

@ariya
Copy link
Contributor

ariya commented Apr 8, 2015

@caridy Have you signed the CLA? Or perhaps the CLA detection bot did not properly pick that up?

@caridy
Copy link
Contributor Author

caridy commented Apr 8, 2015

@ariya I did by email when the transition happened to jquery foundation, and I did it multiple times thru the bot (with n and ñ) it just keep failing on me. Someone will have to do it manually I guess.

@ariya
Copy link
Contributor

ariya commented Apr 8, 2015

@caridy That's what I expect. We'd just ignore the bot for the time being. Thanks!

@ariya ariya closed this in 81acde6 Apr 10, 2015
haoqunjiang added a commit to haoqunjiang/ast-types that referenced this pull request Apr 21, 2020
…field

This reverts the change landed at benjamn@a4cd3e9

As jquery/esprima#1149 was merged long ago,
now the esprima AST is compiliant with the ESTree spec, `id` and `name`
fields now longer exist. It's time to unify the specifier definitions.

Documentation also available at https://esprima.readthedocs.io/en/4.0/syntax-tree-format.html#import-declaration
haoqunjiang added a commit to haoqunjiang/ast-types that referenced this pull request Sep 28, 2020
…field

This reverts the change landed at benjamn@a4cd3e9

As jquery/esprima#1149 was merged long ago,
now the esprima AST is compiliant with the ESTree spec, `id` and `name`
fields now longer exist. It's time to unify the specifier definitions.

Documentation also available at https://esprima.readthedocs.io/en/4.0/syntax-tree-format.html#import-declaration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants