pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
regexp/prefer-named-backreference |
enforce using named backreferences |
v0.9.0 |
🔧 This rule is automatically fixable by the --fix
CLI option.
enforce using named backreferences
This rule reports and fixes backreferences that do not use the name of their referenced capturing group.
/* eslint regexp/prefer-named-backreference: "error" */
/* ✓ GOOD */
var foo = /(a)\1/
var foo = /(?<foo>a)\k<foo>/
/* ✗ BAD */
var foo = /(?<foo>a)\1/
Nothing.
This rule was introduced in eslint-plugin-regexp v0.9.0