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');