Skip to content

Upgrade: acorn 6, acorn-jsx 5, and istanbul - #391

Merged
aladdin-add merged 2 commits into
masterfrom
acorn6
Oct 24, 2018
Merged

Upgrade: acorn 6, acorn-jsx 5, and istanbul#391
aladdin-add merged 2 commits into
masterfrom
acorn6

Conversation

@mysticatea

@mysticatea mysticatea commented Oct 8, 2018

Copy link
Copy Markdown
Member

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

aladdin-add commented Oct 9, 2018

Copy link
Copy Markdown
Member

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 istanbul@0.4.5. Hopefully the pr can be merged soon. 😄

@aladdin-add aladdin-add left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, thanks!

Comment thread lib/espree.js
}, code);

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

@kaicataldo kaicataldo Oct 15, 2018

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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!

Comment thread lib/espree.js
* @returns {number} normalized ECMAScript version
*/
function normalizeEcmaVersion(ecmaVersion) {
if (typeof ecmaVersion === "number") {

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread espree.js
instance.extend("finishNodeAt", wrapFinishNode);

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

Copy link
Copy Markdown
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
Copy Markdown
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.

@kaicataldo kaicataldo left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

friendly ping @kaicataldo , does you comments addressed?

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

@kaicataldo kaicataldo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks!

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

Copy link
Copy Markdown
Member

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
Copy Markdown
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

4 participants