Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 614 Bytes

no-div-regex.md

File metadata and controls

34 lines (21 loc) · 614 Bytes

no-div-regex

Disallows regular expressions that look like division.

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