From 65a6e095f949b84e1db4d124ef630fdc7d8ebb4d Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Wed, 17 Jan 2024 20:04:11 +0530 Subject: [PATCH] docs: update valid-typeof rule --- docs/src/rules/valid-typeof.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/src/rules/valid-typeof.md b/docs/src/rules/valid-typeof.md index 5269cfddba7..4c01f582920 100644 --- a/docs/src/rules/valid-typeof.md +++ b/docs/src/rules/valid-typeof.md @@ -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 @@ -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