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
Sorry for the delayed reply. Re: test cases, I can mostly just think of the failing case in the OP (and its reverse while (null !== (match = regexp.exec(str))) {), as well as this being left as is (passing):
letmatch;while((match=regexp.exec(str))!==null){// ...}returnmatch;// If `match` is used outside of the block, do not report/fix
Not offering a PR here, but just thought such a rule could possibly fit your project...
Namely, preferring
String.prototype.matchAll
towhile
loopexec
assignments.As per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll#Examples , one can replace this:
..with the likes of:
I find it quite a bit more elegant and semantic, and it allows avoiding defining a variable in the parent block.
If not, no worries, just thought I'd see if it might pique the interest of others.
The text was updated successfully, but these errors were encountered: