# es/no-string-prototype-replaceall

disallow the String.prototype.replaceAll method

  • ✅ The following configurations enable this rule: plugin:es/no-new-in-esnext

This rule reports ES2021 String.prototype.replaceAll method (opens new window) as errors.

This rule is silent by default because it's hard to know types. You need to configure the aggressive mode or TypeScript in order to enable this rule.

# 💡 Examples

⛔ Examples of incorrect code for this rule:

/*eslint es/no-string-prototype-replaceall: [error, { aggressive: true }] */ foo.replaceAll("a", "b")
Now loading...

# 🔧 Options

This rule has an option.

rules:
  es/no-string-prototype-replaceall: [error, { aggressive: false }]

# aggressive: boolean

Configure the aggressive mode for only this rule. This is prior to the settings.es.aggressive setting.

# 📚 References