sindresorhus/eslint-plugin-unicorn

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

已关闭

#982 创建于 2021年1月1日

 (2 条评论) (2 个反应) (0 位负责人)JavaScript (468 个派生)user submission
help wantednew rule

仓库指标

星标
 (5,022 个星标)
PR 合并指标
 (平均合并 1天 16小时) (30 天内合并 399 个 PR)

描述

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

贡献者指南