Skip to content

regexp/prefer-result-array-groups

🔧 This rule is automatically fixable by the --fix CLI option.

enforce using result array groups

📖 Rule Details

This rule reports and fixes regexp result arrays where named capturing groups are accessed by index instead of using groups.

Now loading...

🔧 Options

json
{
  "regexp/prefer-result-array-groups": ["error", {
    "strictTypes": true
  }]
}
{
  "regexp/prefer-result-array-groups": ["error", {
    "strictTypes": true
  }]
}
  • strictTypes ... If true, strictly check the type of object to determine if the string instance was used in match() and matchAll(). Default is true.
    This option is always on when using TypeScript.

🚀 Version

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

🔍 Implementation