Open anthony-unicare opened 4 months ago
it is stricter to check the type, probably a logical thing to do. however, there's already a lot of repos out there in the wild that just check the existence.
if we changed this behaviour, we'd cause a lot of headache in terms of people updating their code
given that many people are moving to typescript and needing this rule less over time, i think it makes sense to leave it as it is (even if its a looser check than it could be)
it is stricter to check the type, probably a logical thing to do. however, there's already a lot of repos out there in the wild that just check the existence.
if we changed this behaviour, we'd cause a lot of headache in terms of people updating their code
given that many people are moving to typescript and needing this rule less over time, i think it makes sense to leave it as it is (even if its a looser check than it could be)
Thank you for taking the time to look into my issue report and respond to it.
I understand your point about not wanting to break existing code. I can see two ways to incorporate the change I proposed without breaking anything:
What do you think of these ideas?
we could possibly add an option to the rule, like requireTypeCheck
or something along those lines
if it is enabled, require a typeof
check, otherwise do the current logic
we could possibly add an option to the rule, like
requireTypeCheck
or something along those linesif it is enabled, require a
typeof
check, otherwise do the current logic
That sounds perfect! 👍
@43081j, here’s a pull request: https://github.com/43081j/eslint-plugin-wc/pull/135.
It's better (more explicit) to guard a super call with a typeof check rather than a "truthy" check. Here's a patch to do that.