W3cubDocs

/ESLint

Disallow Regular Expressions That Look Like Division (no-div-regex)

The --fix option on the command line can automatically fix some of the problems reported by this rule.

Require regex literals to escape division operators.

function bar() { return /=foo/; }

Rule Details

This is used to disambiguate the division operator to not confuse users.

Examples of incorrect code for this rule:

/*eslint no-div-regex: "error"*/

function bar() { return /=foo/; }

Examples of correct code for this rule:

/*eslint no-div-regex: "error"*/

function bar() { return /[=]foo/; }

Version

This rule was introduced in ESLint 0.1.0.

Resources

© JS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/rules/no-div-regex