Require Regex Literals to be Wrapped (wrap-regex)
When a regular expression is used in certain situation, it can end up looking like a division operator. For example:
function a() {
return /foo/.test("bar");
}
Rule Details
This is used to disambiguate the slash operator and facilitates in more readable code.
The following patterns are considered warnings:
function a() {
return /foo/.test("bar");
}
The following patterns adhere to this rule:
function a() {
return (/foo/).test("bar");
}
Version
This rule was introduced in ESLint 0.1.0.