From 0bc257c290b12fcda85cb61b40d55fc2be0f938c Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Thu, 8 Jun 2023 17:20:38 +0200 Subject: [PATCH] docs: Clarify `no-div-regex` rule docs (#17051) (#17255) * fix: Clarify `no-div-regex` rule docs * Update opening section --------- Co-authored-by: Milos Djermanovic --- docs/src/rules/no-div-regex.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/rules/no-div-regex.md b/docs/src/rules/no-div-regex.md index ccc7287dcbe..cb30420e700 100644 --- a/docs/src/rules/no-div-regex.md +++ b/docs/src/rules/no-div-regex.md @@ -8,7 +8,7 @@ related_rules: -Require regex literals to escape division operators. +Characters `/=` at the beginning of a regular expression literal can be confused with a division assignment operator. ```js function bar() { return /=foo/; } @@ -16,7 +16,7 @@ function bar() { return /=foo/; } ## Rule Details -This is used to disambiguate the division operator to not confuse users. +This rule forbids equal signs (`=`) after the slash (`/`) at the beginning of a regular expression literal, because the characters `/=` can be confused with a division assignment operator. Examples of **incorrect** code for this rule: