sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules
MIT License
4.14k stars 360 forks source link

`unicorn/better-regex` conflicts with `regexp/strict` and `regexp/match-any` #1852

Open JounQin opened 2 years ago

JounQin commented 2 years ago

From https://github.com/ota-meshi/eslint-plugin-regexp/issues/445

Description

Information:

Description

/\[([^[\]]+)]/g

error from this plugin

Unescaped source character ']'

After fixed:

/\[([^[\]]+)\]/g

error from unicorn/better-regex

/\[([^[\]]+)\]/g can be optimized to /\[([^[\]]+)]/g
/{{([\S\s]+?)}}/g

regexp/match-any is reported

/{{([\s\S]+?)}}/g

unicorn/better-regex is reported

Fail

As above

Pass

As above

Additional Info

I hope these two plugins can work better together by default, some rules can be extracted from unicorn to regexp instead?

JounQin commented 2 years ago

A related previous issue #469, we need to clarify why current rule unicon/better-regex is better.

cc @ota-meshi