-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Enforce comparing typeof
expressions against string literals
#629
Comments
Essentially no ecosystem impact:
|
Make it so |
Why not standard <9 too? |
@dcousens I fear users will get fatigue from too many releases of Also, frankly, it's a lot of work to do a release. It takes at least an hour to properly test everything, write the changelog, update the various packages, etc. I'd prefer to hold back most of these rule changes until |
@feross I feel like we don't thank you enough. Thanks so much for the work, totally understandable. Looking forward to |
@dcousens Thanks. I appreciate your contributions, too! It's really nice to not be in this all alone. 😄 |
…-typeof) Adds { "requireStringLiterals": true } to the 'valid-typeof' rule that we already enforce. Fixes: standard/standard#629
This will be part of standard v9. Only one repo was impacted and it was doing this: const OBJ = 'object'
module.exports = function merge (a, b, checked) {
if (checked || typeof a === OBJ) { Can't see a reason that's preferable to |
…-typeof) Adds { "requireStringLiterals": true } to the 'valid-typeof' rule that we already enforce. Fixes: standard/standard#629
I propose adding
{ "requireStringLiterals": true }
to thevalid-typeof
rule that we already enforce.This requires
typeof
expressions to only be compared to string literals, and disallows comparisons to any other value.Examples of incorrect code:
Examples of correct code:
http://eslint.org/docs/rules/valid-typeof
The text was updated successfully, but these errors were encountered: