Skip to content

Conversation

@mysticatea
Copy link
Member

@mysticatea mysticatea commented Oct 8, 2018

This PR upgrades some dependencies:

  • acorn to 6.0.2 ... This major version has changed the plugin system drastically.
  • acorn-jsx to 5.0.0 to use new plugin system.
  • istanbul to nyc, the official successor of istanbul, to measure coverage for ES2015 syntax (I encountered some conversion errors).

This PR moves the acorn plugin part to ./lib/espree.js from ./espree.js. (...and I deleted some unused logics.) New plugin system is class-based, so I use symbols to store private stuff in order to vaoid confliction with acorn's private stuff.

Probably this upgrade will fix eslint/eslint#10623.
Fixes #390.

@aladdin-add
Copy link
Member

aladdin-add commented Oct 9, 2018

istanbul to nyc, the official successor of istanbul, to measure coverage for ES2015 syntax (I encountered some conversion errors).

I encountered it in #387 , so I upgraded [email protected]. Hopefully the pr can be merged soon. 😄

Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

}, code);

// TODO: remove global state.
commentAttachment.reset();
Copy link
Member

@kaicataldo kaicataldo Oct 15, 2018

Choose a reason for hiding this comment

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

At this point, since we don't use comment attachment in ESLint, I wonder if we should actually remove the comment attachment option in the future? I don't think it adds much value as of right now and adds some maintenance burden.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. We can remove the comment attachment logic in the future.
But this PR focuses on upgrading acorn since it's a breaking change that removes attarchComment option.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, sorry I wasn't clear. Wasn't trying to suggest we change that in this PR!

* @returns {number} normalized ECMAScript version
*/
function normalizeEcmaVersion(ecmaVersion) {
if (typeof ecmaVersion === "number") {
Copy link
Member

Choose a reason for hiding this comment

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

I know this is the current behavior, but I wonder if we should print a warning or something in the case that ecmaVersion is not a number? It seems like it could be hard for a user to debug this if they had set the value to "9" and it kept parsing with ES5.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is a related issue: #384.

instance.extend("finishNodeAt", wrapFinishNode);

instance.extend("next", function(next) {
return /** @this acorn.Parser */ function() {
Copy link
Member

Choose a reason for hiding this comment

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

Is this behavior already taken care of in the super class's method?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. This override exists to address acornjs/acorn#363 and it has been fixed.

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

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

Have just a few questions. Thanks for working this!

@aladdin-add
Copy link
Member

friendly ping @kaicataldo , does you comments addressed?

/cc. @mysticatea seems there's a conflict need to resolve.

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

Copy link
Member

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

I fixed the merge conflict in .gitignore.

@aladdin-add aladdin-add merged commit 8eadb88 into master Oct 24, 2018
@aladdin-add aladdin-add deleted the acorn6 branch October 24, 2018 01:46
@mysticatea
Copy link
Member Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade acorn to 6.x Cannot read property 'ecmaFeatures' of undefined

5 participants