regexp/no-extra-lookaround-assertions
💼 This rule is enabled in the following configs: 🟢 flat/recommended
, 🔵 recommended
.
🔧 This rule is automatically fixable by the --fix
CLI option.
disallow unnecessary nested lookaround assertions
📖 Rule Details
The last positive lookahead assertion within a lookahead assertion is the same without lookahead assertions. Also, The first positive lookbehind assertion within a lookbehind assertion is the same without lookbehind assertions. They can be inlined or converted to group.
js
/a(?=b(?=c))/u; /* -> */ /a(?=bc)/u;
/a(?=b(?=c|C))/u; /* -> */ /a(?=b(?:c|C))/u;
/(?<=(?<=a)b)c/u; /* -> */ /(?<=ab)c/u;
/(?<=(?<=a|A)b)c/u; /* -> */ /(?<=(?:a|A)b)c/u;
This rule aims to report and fix these unnecessary lookaround assertions.
🔧 Options
Nothing.
🚀 Version
This rule was introduced in eslint-plugin-regexp v1.11.0