sindresorhus/eslint-plugin-unicorn
Enforce `.replaceAll()` over `.split().join()` in `prefer-string-replace-all` rule
已關閉
#1,441 建立於 2021年7月23日
enhancementhelp wanted
倉庫指標
- 星標
- (5,022 顆星)
- PR 合併指標
- (平均合併 1天 16小時) (30 天內合併 399 個 PR)
描述
Fail
foo.split('a').join('b');
Pass
foo.replaceAll('a', 'b');
// Not sure about this, maybe add `g` flag, result the same?
foo.split(/a+/).join('b');
// Different with foo.replaceAll('', 'b');
foo.split('').join('b');