Open ota-meshi opened 2 months ago
How about prefer-named-backreference
with option to report only if backreference
is duplicate names.
Hmm... I think the purpose is a bit different from prefer-named-backreference
, which always recommends named backreferences, because we don't know whether users should change backreferences or rename named capturing groups in response to the new rule report.
Motivation
ES2025 now allows duplicate named capturing groups. But using numbers to backreference them seems very hard to read and misleading, so I'd like to add a rule to disallow that.
Description
The new rule will flag as an error if a numbered backreference refers to a duplicate named capturing group.
Examples
Maybe there's a better rule name 🤔