-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Update: support bigint and dynamic import #415
Conversation
@@ -29,6 +29,11 @@ function getRaw(ast) { | |||
return undefined; // eslint-disable-line no-undefined | |||
} | |||
|
|||
// JSON cannot handle BigInt. | |||
if (typeof value === "bigint") { | |||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests depend on JSON heavily, but JSON doesn't support BigInt values. So tests handle Literal#value
as null. I think that this is not a big problem because it's null if runtime doesn't support bigint natively.
Looks like the fixture previously assumed the `expression` node would be where the error is located, but it looks like the error is located at the `import` token instead.
@mysticatea I've tried to push a few changes to consume the new acorn and eslint-visitor-keys, and then fixed a failing test. Please review the latest commits on this branch and let me know if there are issues. (Thinking about it now, I should have made a PR targeting this branch so you could review using the PR review tools. Sorry about that.) |
@platinumazure Thank you so much! |
LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes LGTM, but I would like another team member to review this since I have also pushed changes to this branch. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 💯
|
||
script: | ||
- if [ $TRAVIS_NODE_VERSION -ge 8 ]; then node Makefile.js lint; fi | ||
- node Makefile.js test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity: this was added since eslint v6 don't support node <8?
we may consider dropping node <8, as it has been EOL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aladdin-add I assume that was the case (but hopefully @mysticatea can confirm). I think it makes sense to release a minor version of espree with this functionality if we can, and then we could do a major release to drop Node <8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for working on this!
This PR adds supports of bigint and dynamic import.
ecmaVersion
option was2020
or11
.Literal
node that hasbigint
property. Thebigint
property has the source code text of the bigint literal without the suffixn
.ImportExpression
node. Thesource
property is the importing source as similar toImportDeclaration
node, but thesource
property can be an arbitrary expression node.