sindresorhus/eslint-plugin-unicorn

Rule proposal: `prefer-regexp-dot-all`

クローズ

#982 opened on 2021/01/01

 (2 件のコメント) (2 件のリアクション) (0 人の担当者)JavaScript (468 件のフォーク)user submission
help wantednew rule

Repository metrics

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

説明

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll

https://github.com/tc39/proposal-regexp-dotall-flag

This could be auto-fixed as long as the regex doesn't contain a . pattern. If it does, we can do a suggestion instead.

Fail

/foo[^]bar/.test('foo\nbar');
/foo[\s\S]bar/.test('foo\nbar');
/foo[\S\s]bar/.test('foo\nbar');
/foo[\w\W]bar/.test('foo\nbar');
/foo[\W\w]bar/.test('foo\nbar');
/foo[\d\D]bar/.test('foo\nbar');
/foo[\D\d]bar/.test('foo\nbar');

Pass

/foo.bar/s.test('foo\nbar');

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