sindresorhus/eslint-plugin-unicorn
Enforce `.replaceAll()` over `.split().join()` in `prefer-string-replace-all` rule
Chiusa
#1441 aperta il 23 lug 2021
enhancementhelp wanted
Metriche repository
- Star
- (5022 stelle)
- Metriche merge PR
- (Merge medio 4h 30m) (26 PR mergiate in 30 g)
Descrizione
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');