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
Fix prevent-abbreviations
fixer bug
#444
Conversation
rules/prevent-abbreviations.js
Outdated
( | ||
identifier.parent.key.type === identifier.type && | ||
identifier.parent.key.name === identifier.name && | ||
identifier.parent.key.start === identifier.start && | ||
identifier.parent.key.end === identifier.end | ||
) |
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.
I don't have much experience on those AST
s, I'm not sure if this is good
also there is a few other functions in this file compares |
rules/prevent-abbreviations.js
Outdated
identifier.parent.shorthand && | ||
( | ||
identifier.parent.key === identifier || | ||
// In `babel-eslint` parent.key is not reference of identifier |
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.
Can you open an issue about this on babel-eslint
? The point of that package is to normalize the AST.
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.
you are right, we might not do this check, I've found other cases also broken, let me have a look at their repo first
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.
I’m ok with working around it, but we should always also try to get it fixed upstream.
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.
Add a code comment with a link to the Babel-eslint issue.
i just confirmed |
fixes: #443 and fixes #330
I've located the problem, in
isShorthandPropertyIdentifier
check function, Inbabel-eslint
parent.key is not reference of identifier, add a extra check to make it pass