-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Add check for reference-compared literals to JS files #49164
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Plain JS tests are in A couple of gotchas I thought of:
At least, I think there are shenanigans possible with |
I think there's no need to support the first case. The second case is a bit more interesting, maybe I can add detection to check if the literal contains |
Add test files. |
A couple more examples from @bradzacher's comment: [1,2,3] == '1,2,3'
// -> true
({toString() { return 1 }}) == 1
// -> true The second one is pretty close to the second example in my comment but arguably more likely to be written as a weird workaround for something. Even a weird workaround shouldn't have an error in JS given the reaction of some JS users when an unavoidable red squiggly shows up. |
So we only emit it for |
Yeah, I think so. |
02a9fd2
to
23c0797
Compare
done |
rebased |
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.
Almost ready, just one more change.
It's been a long time, so if you want me to finish this, let me know.
cded754
to
f9c029e
Compare
f9c029e
to
8925689
Compare
I don't know where I can add a test for JS files.
According to discussion in #45978, I open this PR to also check JavaScript files.