You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/prefer-regex-literals.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,38 @@ RegExp(`${prefix}abc`);
88
88
newRegExp(String.raw`^\d\.${suffix}`);
89
89
```
90
90
91
+
## Options
92
+
93
+
This rule has an object option:
94
+
95
+
*`disallowRedundantWrapping` set to `true` additionally checks for unnecessarily wrapped regex literals (Default `false`).
96
+
97
+
### `disallowRedundantWrapping`
98
+
99
+
By default, this rule doesn’t check when a regex literal is unnecessarily wrapped in a `RegExp` constructor call. When the option `disallowRedundantWrapping` is set to `true`, the rule will also disallow such unnecessary patterns.
100
+
101
+
Examples of `incorrect` code for `{ "disallowRedundantWrapping": true }`
0 commit comments