sindresorhus/eslint-plugin-unicorn
Enforce `.replaceAll()` over `.split().join()` in `prefer-string-replace-all` rule
Fermée
#1 441 ouverte le 23 juil. 2021
enhancementhelp wanted
Métriques du dépôt
- Stars
- (5 022 étoiles)
- Métriques de merge PR
- (Merge moyen 1j 16h) (399 PRs mergées en 30 j)
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');