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
Rule proposal: prefer-t-regex
#163
Comments
Sounds good to me 👍 In the case of
t.true(foo().search(/\d+/)); Didn't know this API 🤔 t.truthy(foo().match(/\d+/)); For both of these, if they have regexes as the sole argument, I'd say yes. For |
Huh? Why not |
Ha, yes, that's better obviously 😅 |
@IssueHunt has funded $60.00 to this issue.
|
@sindresorhus has rewarded $54.00 to @GMartigny. See it on IssueHunt
|
Users should prefer the
regex
assertion as it's more readable and gives better output.Fail
Pass
Same for the negated ones, with
t.notRegex
.Would also be useful to be able to detect the regex from a variable somewhere else in the scope as I often share a regex between multiple asserts:
This could be auto-fixable, right?
Should we also detect the following?
IssueHunt Summary
gmartigny has been rewarded.
Sponsors (Total: $60.00)
Tips
The text was updated successfully, but these errors were encountered: