Skip to content

Files

Latest commit

 

History

History
19 lines (13 loc) · 357 Bytes

prefer-named-backreference.md

File metadata and controls

19 lines (13 loc) · 357 Bytes

Pattern: Missing use of named backreference

Issue: -

Description

This rule reports and fixes backreferences that do not use the name of their referenced capturing group.

Examples

/* eslint regexp/prefer-named-backreference: "error" */
/* ✓ GOOD */
var foo = /(a)\1/
var foo = /(?<foo>a)\k<foo>/

/* ✗ BAD */
var foo = /(?<foo>a)\1/