question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`valid-typeof` with `requireStringLiterals` should allow two `typeof` comparisons

See original GitHub issue

What 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:closed
  • Created 7 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
platinumazurecommented, Sep 8, 2016

I can live with that for now. Maybe in a major (5.0?) we can rename the option or something.

1reaction
not-an-aardvarkcommented, Sep 8, 2016

Working on this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found