-
Notifications
You must be signed in to change notification settings - Fork 148
fix(prefer-wait-for): only report when imported from TL #152
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
context | ||
.getDeclaredVariables(importSpecifier) | ||
.forEach(variable => | ||
variable.references.forEach(reference => | ||
reportWait(reference.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.
Is there a way we could make this cleaner? 👀
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.
perhaps
context
.getDeclaredVariables(importSpecifier)
.flatMap(variable => variable.references)
.forEach(({ identifier })=> reportWait(identifier))
? But IMO it's not too much of a difference - I think this is fine
And I think flatMap does not work in node <= 10
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.
Indeed, we can't use flatMap in node 10
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.
Maybe we could make the code cleaner by extracting the first forEach callback to its own function? It's the only thing I can think of.
code: ` | ||
cy.wait(); | ||
`, | ||
}, |
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 think we should consider testing require
scenarios as well
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.
It would be nice if we can have an additional test for it, indeed.
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.
Thanks for your PR Tim, just a simple request for adding an extra test.
code: ` | ||
cy.wait(); | ||
`, | ||
}, |
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.
It would be nice if we can have an additional test for it, indeed.
This won't be just additional tests, it would also mean that we have to modify the rule. const { wait } = require("@testing-library/foo");
async () => {
await wait();
} |
Ah of course. Fair enough, I'll approve it then. |
🎉 This PR is included in version 3.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@all-contributors please add @Miguelerja for bug |
I've put up a pull request to add @Miguelerja! 🎉 |
Closes #151