-
Notifications
You must be signed in to change notification settings - Fork 248
feat(rules): add prefer-strict-equal #134
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
|
The desire to make strict equality the default behaviour has been discussed. This rule at least makes it enforceable. Maybe this should be a part of the |
1bfcd98 to
d7c2c33
Compare
docs/rules/prefer-strict-equal.md
Outdated
| # Suggest using `toStrictEqual()` (prefer-strict-equal) | ||
|
|
||
| `toStrictEqual` not only checks that two objects contain the same data but also | ||
| that they have the same shape. The believe is that imposing a stricter equality |
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.
"The believe is that" sounds odd. Could you re-phrase?
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 tweaked and expanded on this a bit in a7ca3b2
SimenB
left a comment
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 sending a PR! Left some comments in the docs, code LGTM
docs/rules/prefer-strict-equal.md
Outdated
|
|
||
| This rule triggers a warning if `toEqual()` is used to assert equality. | ||
|
|
||
| This rule is enabled by default. |
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.
no it's not 🙂
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, addressed in a7ca3b2
Also remove mention of the rule being enabled by default. It's not
|
Thanks! |
|
🎉 This PR is included in version 21.21.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR will
Implement the
prefer-strict-equalrule. This rule serves to encourage stricter equality checks on objects.Why?
The believe is that imposing stricter equality results in safer tests.