-
Notifications
You must be signed in to change notification settings - Fork 21
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
Warn against a non-object expected value given to propEqual #90
Comments
Yes, let's create a new rule for this. Open to name suggestions. I also think this probably should be added to recommended in a major release. I think it's probably too late to do this for the current upcoming major release but we'll see. |
Working on this. |
platinumazure
added a commit
that referenced
this issue
Feb 14, 2021
platinumazure
added a commit
that referenced
this issue
Feb 14, 2021
I've created #148 to implement this. |
platinumazure
added a commit
that referenced
this issue
Mar 9, 2021
* New: use-object-in-propequal rule (fixes #90) * Chore: Remove bigint tests until we drop support for ESLint 5 * Update: Allow array expressions * Chore: Rename rule to require-object-in-propequal * Chore: Fix rule id in test file * Chore: Fix README to account for rule name update * Update: Support optional expressions * Chore: Improve logic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
propEqual (docs) is for the strict-equality comparing of own properties of two objects. When the
actual
value is a non-object, such as a string, it can act in somewhat unexpected ways.For example:
This is because the values compared are the boxed-object equivalent of the strings. Similar to what
Object('foo')
, ornew String('foo')
, or'foo'.split('')
would produce.Ref qunitjs/qunit#411 (comment).
The text was updated successfully, but these errors were encountered: