-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Milestone
Description
I propose adding { "requireStringLiterals": true } to the valid-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:
typeof foo === undefined
typeof bar == Object
typeof baz === 'strnig'
typeof qux === 'some invalid type'
typeof baz === anotherVariable
typeof foo == 5
typeof bar === typeof quxExamples of correct code:
typeof foo === 'undefined'
typeof bar == 'object'
typeof baz === 'string'jprichardson, ifraixedes, LinusU, Flet, dcousens and 5 moretunnckoCore
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done