title | description | since |
---|---|---|
es-x/no-string-prototype-replaceall |
disallow the `String.prototype.replaceAll` method |
[eslint-plugin-es] v5.0.0 |
disallow the
String.prototype.replaceAll
method
- ✅ The following configurations enable this rule: no-new-in-es2021, restrict-to-es3, restrict-to-es5, restrict-to-es2015, restrict-to-es2016, restrict-to-es2017, restrict-to-es2018, restrict-to-es2019, and restrict-to-es2020
This rule reports ES2021 String.prototype.replaceAll
method 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 of incorrect code for this rule:
/*eslint es-x/no-string-prototype-replaceall: [error, { aggressive: true }] */
foo.replaceAll("a", "b")
This rule has an option.
rules:
es-x/no-string-prototype-replaceall: [error, { aggressive: false }]
Configure the aggressive mode for only this rule.
This is prior to the settings['es-x'].aggressive
setting.
This rule was introduced in eslint-plugin-es v5.0.0.