-
Notifications
You must be signed in to change notification settings - Fork 242
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
no-test-callback autofix can produce invalid code #466
Comments
I'm not really sure what we can do about this aside from putting We'd have to check the entire body for the use of @SimenB any thoughts on how we could tackle this? |
If the function is an async function, the generated handler should also be We could also bail on
My thinking was that people also run |
Fine to me
true, in my setup I need an additional |
FWIW we should yell at this in Jest itself at runtime - you should either use the callback or return a promise, never both EDIT: Opened up jestjs/jest#9129 for it |
🎉 This issue has been resolved in version 23.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
amazing, thanks 🙌 |
On an aside, this could be a good place to use the new eslint suggestions API:
I've not looked into, but since it requires user interaction, it might mean you can have your cake and eat it too? |
Oooh, exciting! Didn't know about that. Seems the pr with the implementation landed today |
Yeah, that's how I found out about it - probably want to wait at least a few months before we consider actually shipping something that uses it (unless that won't break? I'm not sure how backwards combat works w/ eslint plugins - now that I type this, I'm assuming it'll just be a property prior version of eslint would just ignore, so maybe we can start shipping 🤔). If it works how I'd expect by the description, it should allow for a lot more auto-fixes a la codemod. |
Yeah, I'd hope we can ship this without waiting. Might need to wait for typescript-eslint to add types for it though (typescript-eslint/typescript-eslint#1249) |
@G-Rath support released, if you wanna play with it: https://github.com/typescript-eslint/typescript-eslint/releases/tag/v2.9.0 |
Hello team,
With the release of
v23
our team had issues with the new recommended rules, and in particularno-test-callback
.This code is marked as
Illegal usage of test callback
which is a fair warning; I would say thedone
usage is more useless than illegal (but just a matter of wording here).This code will be transformed to:
Which is:
async
methodasync
keyword you can encounter an other linter errorno-async-promise-executor
This is not a bug nor an urgent matter, but I would be in favor of letting the user change his/her code instead of modifying the behaviour of the test without the user paying attention.
Have a great day,
The text was updated successfully, but these errors were encountered: