regexp/prefer-predefined-assertion
💼 This rule is enabled in the following configs: 🟢 flat/recommended
, 🔵 recommended
.
🔧 This rule is automatically fixable by the --fix
CLI option.
prefer predefined assertion over equivalent lookarounds
📖 Rule Details
All predefined assertions (\b
, \B
, ^
, and $
) can be expressed as lookaheads and lookbehinds. E.g. /a$/
is the same as /a(?![^])/
.
In most cases, it's better to use the predefined assertions because they are better known.
🔧 Options
Nothing.
🚀 Version
This rule was introduced in eslint-plugin-regexp v0.10.0