Skip to content

Commit a8338ab

Browse files
authored
prefer-regexp-test: Improve TypeScript support (#3193)
1 parent 154049f commit a8338ab

7 files changed

Lines changed: 556 additions & 129 deletions

File tree

docs/rules/prefer-regexp-test.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
When you want to know whether a pattern is found in a string, use [`RegExp#test()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) instead of [`String#match()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match), [`String#search()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/search), and [`RegExp#exec()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec), as it exclusively returns a boolean and therefore is more efficient.
1313

14-
Calls like `slice.actions.someAction.match(action)` are ignored because they are Redux Toolkit slice action matchers, not `String#match()`.
15-
1614
## Examples
1715

1816
```js

0 commit comments

Comments
 (0)