valid-typeof
eslint
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"valid-typeof": "error",
},
},
];typeof foo === "strnig"
typeof foo == "undefimed"
typeof bar != "nunber"
typeof bar !== "fucntion"typeof foo === "string"
typeof bar == "undefined"
typeof foo === baz
typeof bar === typeof quxExamples from the ESLint documentation.
valid-typeof
eslint
export default [
{
rules: {
"valid-typeof": "error",
},
},
];valid-typeof
eslint plugin · correctness
{
"rules": {
"valid-typeof": "error"
}
}correctness/useValidTypeof
correctness · since 1.0.0
{
"linter": {
"rules": {
"correctness": {
"useValidTypeof": "error"
}
}
}
}Disallow assignments where both sides are exactly the same
Disallow empty destructuring patterns
Disallow reassigning const, using, and await using variables
Disallow duplicate keys in object literals