Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Clarify no-div-regex rule docs #17051

Merged
merged 2 commits into from Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Require regex literals to escape equal signs at the beginning.
fasttime marked this conversation as resolved.
Show resolved Hide resolved

```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