sindresorhus/eslint-plugin-unicorn
View on GitHubEnforce `.replaceAll()` over `.split().join()` in `prefer-string-replace-all` rule
Open
#1,441 opened on Jul 23, 2021
enhancementhelp wanted
Description
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');