regexp/prefer-named-replacement
🔧 This rule is automatically fixable by the --fix
CLI option.
enforce using named replacement
📖 Rule Details
This rule reports and fixes $n
parameter in replacement string that do not use the name of their referenced capturing group.
🔧 Options
json
{
"regexp/prefer-named-replacement": ["error", {
"strictTypes": true
}]
}
strictTypes
... Iftrue
, strictly check the type of object to determine if the string instance was used inreplace()
andreplaceAll()
. Default istrue
.
This option is always on when using TypeScript.
👫 Related rules
🚀 Version
This rule was introduced in eslint-plugin-regexp v1.4.0