Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (20 sloc) 613 Bytes

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

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/; }

Related Rules

You can’t perform that action at this time.