-
Notifications
You must be signed in to change notification settings - Fork 41
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
match toBe(null)
and possibly toEqual(null)
in addition to toBeNull
#152
Comments
Should be. Care to open a PR? |
TBH I would love to, but I don't know how to write eslint rules. If you know similar examples I could have a look, but for now I looked at the source code for this rule and I have no idea how to change that... |
for sure, it's a great skill to learn and once you do it's actually a ton of fun! The docs on eslint are a good placed to start. A thing to note, the function names are AST selectors (think CSS selectors, but for code). that may seem strange, but consider this code: const foo = { "bar": function() {} }; then consider that this function can use the shorthand notation like this: const foo = { "bar"() {} }; and if you have a variable you can do this: const x = "baz";
const foo = { [`bar ${x}`]() {} } which could be called like this: foo["bar baz"](); an eslint rule uses that pattern (as many of the rules in this plugin do) to declaratively handle various use cases. So for example, if you wanted a rule to match all CallExpressions you would do
if you wanted a rule to match all call expressions that were named 'foo' (as in
(that might look familiar if you've ever written a CSS selector like |
Thanks for the pointers, I think I managed to do something. |
…in prefer-document Fixes testing-library#152
…in prefer-document Fixes testing-library#152
🎉 This issue has been resolved in version 3.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
In a few rules (eg:
prefer-document
)toBeNull()
will be replaced bytoBeInTheDocument()
which is nice.Is it possible to match
toBe(null)
andtoEqual(null)
as well?Thanks!
The text was updated successfully, but these errors were encountered: