-
Notifications
You must be signed in to change notification settings - Fork 234
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
Are you open to support context
as describe
alias?
#83
Comments
I'm open to a PR allowing aliases for the globals 🙂
This is possible, see https://eslint.org/docs/user-guide/configuring#adding-shared-settings |
Thanks @SimenB . I'l give the PR a try then :) And good to know about the shared settings! |
@raulmt do you managed to config context as aliases to describe through Adding Shared Settings? thanks in advance. |
@leoneves no, I haven't done this yet, sorry… |
The Preact tests generally don't use `context` blocks and the ESLint rules don't know to treat a `context` block like `describe` (see jest-community/eslint-plugin-jest#83)
👍 for this as well. i fell in love with |
its always strange coming across your old comments... any plans on adding this support? |
@brewster1134 yes, this is something we would like to have and on the face it's not even that hard to do - the wrinkle is with how ESLint currently handles settings which makes it a hard API to work with: it does a weird "replace merge", instead of straight overriding or merging. For example, if we had I found this out when starting to write tests for an initial settings-based implementation, and it was very confusing so I would expect it to be even more confusing for developers trying to configure their linter. Apparently the new "flat" config system ESLint is switching to does away with this, so currently I'm sort of just waiting until either:
|
after looking at the code, it does use a whitelist approach. adding support for |
Adding support for assuming that there is a function provided by Jest called What we're open to is supporting providing this plugin with a list of aliases for these Jest functions as part of it's configuration, for which |
Once I've landed the implementation for #1106 you'll be able to do this with
is valid and will be understood by |
I've opened #1129 that implements this, but I'm on the fence about actually landing it given you should be able to archive the same result by just importing from |
🎉 This issue has been resolved in version 26.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Up until around 1 year ago,
context
was an officially supporteddescribe
alias, but later got removed. Still, because of its value, some people (myself included) still want to use it, and as explained on that issue it's very easy to add it back.Unfortunately, it's not compatible with using this ESLint plugin (and I really like this plugin :) ). Would you be open to merge a PR adding
context
(and derivedcontext.only
, …) to the describe aliases and other places where it would be needed?I understand maybe you wouldn't want to have defaults that are different to what jest itself has in terms of globals, but if so, maybe adding it as a configurable option instead? Afaik, the plugin itself cannot receive a configuration though, so apparently that would need to be done by passing options to each applicable rule.
If you are open to this I can give a PR a try. Or if you have any other suggestion on how to use ´context´ and this plugin at the same time, I would love to hear it.
Thanks for this plugin!
The text was updated successfully, but these errors were encountered: