-
Notifications
You must be signed in to change notification settings - Fork 40
fix(prefer-in-document): check that a node has arguments before trying to access properties on them #165
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
Conversation
@all-contributors please add @G-Rath for tests, code, bugs |
I've put up a pull request to add @G-Rath! 🎉 |
@G-Rath thanks for finding & fixing this! |
Codecov Report
@@ Coverage Diff @@
## master #165 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 381 383 +2
Branches 69 69
=========================================
+ Hits 381 383 +2
Continue to review full report at Codecov.
|
@benmonro I've got some more fixes of this nature, which I'll push into this PR. |
@G-Rath sounds good just let me know when to merge |
3f00a90
to
228e760
Compare
@benmonro this one should be good to go now. |
toHaveLength
without arguments
🎉 This PR is included in version 3.8.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What:
It seems that
prefer-in-document
crashes in situations where it expected nodes to have an argument but they actually don't.Why:
The rule assumes that if it's found the node its looking for, then the node has to have arguments and so makes property access keys in the first item in the args array without actually checking if its defined.
How:
I've added checks for the argument length before attempts to access said arguments.
Checklist: