]> git.proxmox.com Git - pve-eslint.git/blob - eslint/docs/rules/no-div-regex.md
bump version to 8.4.0-3
[pve-eslint.git] / eslint / docs / rules / no-div-regex.md
1 # Disallow Regular Expressions That Look Like Division (no-div-regex)
2
3 Require regex literals to escape division operators.
4
5 ```js
6 function bar() { return /=foo/; }
7 ```
8
9 ## Rule Details
10
11 This is used to disambiguate the division operator to not confuse users.
12
13 Examples of **incorrect** code for this rule:
14
15 ```js
16 /*eslint no-div-regex: "error"*/
17
18 function bar() { return /=foo/; }
19 ```
20
21 Examples of **correct** code for this rule:
22
23 ```js
24 /*eslint no-div-regex: "error"*/
25
26 function bar() { return /[=]foo/; }
27 ```
28
29 ## Related Rules
30
31 * [no-control-regex](no-control-regex.md)
32 * [no-regex-spaces](no-regex-spaces.md)