sindresorhus/eslint-plugin-unicorn

Enforce `.replaceAll()` over `.split().join()` in `prefer-string-replace-all` rule

クローズ

#1,441 opened on 2021/07/23

 (4 件のコメント) (3 件のリアクション) (0 人の担当者)JavaScript (468 件のフォーク)user submission
enhancementhelp wanted

Repository metrics

Stars
 (5,022 個のスター)
PR merge metrics
 (平均マージ 4h 30m) (30d で 26 merged PRs)

説明

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

コントリビューターガイド