regexp/no-contradiction-with-assertion
💼 This rule is enabled in the following configs: 🟢 flat/recommended
, 🔵 recommended
.
💡 This rule is manually fixable by editor suggestions.
disallow elements that contradict assertions
📖 Rule Details
This rule reports elements that contradict an assertion. All elements reported by this rule fall into one of two categories:
An element/alternative that can never be entered.
This means that the element is dead code and can be removed. Example:
An element that is always entered.
Right now, only quantifiers with a minimum of 0 are reported in this category. They are contradictory because the minimum of 0 is changed by the assertion to be effectively 1. Example:
This rule is quite similar to regexp/no-useless-assertions. While regexp/no-useless-assertions tries to find assertions that contradict the pattern, this rule tries to find parts of the pattern that contradict assertions.
🔧 Options
Nothing.
📚 Further reading
🚀 Version
This rule was introduced in eslint-plugin-regexp v1.2.0