`valid-typeof` with `requireStringLiterals` should allow two `typeof` comparisons
See original GitHub issueWhat version of ESLint are you using? v3.4.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
just 'valid-typeof': ['error', { requireStringLiterals: true }]
What did you do? Please include the actual source code causing the issue.
echo 'typeof foo === typeof bar' | eslint --stdin --no-eslintrc --rule valid-typeof:'[2,{requireStringLiterals: true}]'
What did you expect to happen? No error.
What actually happened? Please include the actual, raw output from ESLint.
text>
1:1 error Typeof comparisons should be to string literals valid-typeof
1:16 error Typeof comparisons should be to string literals valid-typeof
✖ 2 problems (2 errors, 0 warnings)
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
valid-typeof - ESLint - Pluggable JavaScript Linter
This rule enforces comparing typeof expressions to valid string literals. Options. This rule has an object option: "requireStringLiterals": true requires typeof ...
Read more >A typeof Typo - Aleksandr Hovhannisyan
This condition will always evaluate to false . It's 'undefined' , not undefined. The typeof unary operator returns a string describing the type...
Read more >why is "typeof v === 'string'" considered invalid by eslint
It's because you're using Angular, which has a built-in isString method, and you have the Angular plugin installed for eslint.
Read more >valid-typeof - ESLint Config
This rule enforces comparing typeof expressions to valid string literals. What ESLint should do when it catches the rule break. Show a warning ......
Read more >typescript typeof comparison - Buddhist Magic
Let start today tutorial How to check type of variable in typescript? Options. is the same. To compare two dates without the time...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can live with that for now. Maybe in a major (5.0?) we can rename the option or something.
Working on this.