# regexp/no-useless-non-capturing-group

disallow unnecessary Non-capturing group

  • ⚙️ This rule is included in "plugin:regexp/recommended".
  • 🔧 The --fix option on the command line (opens new window) can automatically fix some of the problems reported by this rule.

# 📖 Rule Details

This rule reports unnecessary non-capturing group

Now loading...

# 🔧 Options

  "regexp/no-useless-non-capturing-group": ["error", {
    "allowTop": "partial" // or "always" or "never"
  • "allowTop": Whether a top-level non-capturing group is allowed. Defaults to "partial".

    Sometimes it's useful to wrap a whole pattern into a non-capturing group (e.g. when the pattern is used as a building block to construct more complex patterns). Use this option to allow top-level non-capturing groups.

    • "partial": Allows top-level non-capturing groups of patterns used as strings via .source.

      Now loading...
    • "always": Always allow top-level non-capturing groups.

      Now loading...
    • "never": Never allow top-level non-capturing groups.

      Now loading...

# 🚀 Version

This rule was introduced in eslint-plugin-regexp v0.4.0

# 🔍 Implementation

Last Updated: 6/25/2022, 12:32:38 PM