Skip to content


💼 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:

  1. An element/alternative that can never be entered.

    This means that the element is dead code and can be removed. Example:

    Now loading...
  2. 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:

    Now loading...

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.

Now loading...

🔧 Options


📚 Further reading

🚀 Version

This rule was introduced in eslint-plugin-regexp v1.2.0

🔍 Implementation