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: func-name-matching crash on descriptor-like arguments #12100
Fix: func-name-matching crash on descriptor-like arguments #12100
Conversation
I can reproduce it on demo. |
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!
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!
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!
Thanks for contributing to ESLint! |
What is the purpose of this pull request? (put an "X" next to item)
[X] Bug fix
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
Not to crash.
What actually happened? Please include the actual, raw output from ESLint.
TypeError: Cannot read property 'name' of undefined
What changes did you make? (Give an overview)
Fixed the bug.
Is there anything you'd like reviewers to focus on?
There is still a number of places where the rule can crash or produce false positives on a designed example, as the code doesn't check parent types, correct index of the child in parent's arguments, existence and types of other arguments from which it reads etc.
The example which is fixed in this PR can easily occur in a real code, so it might make sense to fix just this at the moment.
For the rest, I believe it would be better to make helpers in
astUtils
as there are at least 3 other rules that also work with descriptors and have a very similar code (and some small bugs as well).