Skip to content

regexp/no-legacy-features

💼 This rule is enabled in the ✅ plugin:regexp/recommended config.

disallow legacy RegExp features

📖 Rule Details

This rule disallow legacy RegExp features.

Now loading...

🔧 Options

json
{
  "regexp/no-legacy-features": ["error", {
    "staticProperties": [
      "input", "$_",
      "lastMatch", "$&",
      "lastParen", "$+",
      "leftContext", "$`",
      "rightContext", "$'",
      "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9"
    ],
    "prototypeMethods": ["compile"]
  }]
}
{
  "regexp/no-legacy-features": ["error", {
    "staticProperties": [
      "input", "$_",
      "lastMatch", "$&",
      "lastParen", "$+",
      "leftContext", "$`",
      "rightContext", "$'",
      "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9"
    ],
    "prototypeMethods": ["compile"]
  }]
}
  • staticProperties ... An array of legacy static properties to forbid.
  • prototypeMethods ... An array of legacy prototype methods to forbid.

📚 Further reading

🚀 Version

This rule was introduced in eslint-plugin-regexp v0.6.0

🔍 Implementation