Skip to content

Commit

Permalink
docs: update valid-typeof rule (#18001)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanujkanti4441 committed Jan 17, 2024
1 parent 39076fb commit 38b9b06
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/src/rules/valid-typeof.md
Expand Up @@ -15,12 +15,6 @@ For a vast majority of use cases, the result of the `typeof` operator is one of

This rule enforces comparing `typeof` expressions to valid string literals.

## Options

This rule has an object option:

* `"requireStringLiterals": true` requires `typeof` expressions to only be compared to string literals or other `typeof` expressions, and disallows comparisons to any other value.

Examples of **incorrect** code for this rule:

::: incorrect
Expand Down Expand Up @@ -51,6 +45,14 @@ typeof bar === typeof qux

:::

## Options

This rule has an object option:

* `"requireStringLiterals": true` allows the comparison of `typeof` expressions with only string literals or other `typeof` expressions, and disallows comparisons to any other value. Default is `false`.

### requireStringLiterals

Examples of **incorrect** code with the `{ "requireStringLiterals": true }` option:

::: incorrect
Expand Down

0 comments on commit 38b9b06

Please sign in to comment.