Skip to content

Commit

Permalink
docs: Clarify no-div-regex rule docs (#17051)
Browse files Browse the repository at this point in the history
* fix: Clarify `no-div-regex` rule docs

* Update opening section

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

---------

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
  • Loading branch information
fasttime and mdjermanovic committed Apr 4, 2023
1 parent 0dde022 commit a3aa6f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/src/rules/no-div-regex.md
Expand Up @@ -8,15 +8,15 @@ 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/; }
```

## 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:

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-div-regex.js
Expand Up @@ -15,7 +15,7 @@ module.exports = {
type: "suggestion",

docs: {
description: "Disallow division operators explicitly at the beginning of regular expressions",
description: "Disallow equal signs explicitly at the beginning of regular expressions",
recommended: false,
url: "https://eslint.org/docs/rules/no-div-regex"
},
Expand Down

0 comments on commit a3aa6f5

Please sign in to comment.