Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[es2021] replaceAll no warning #496

Open
hothvictor opened this issue Nov 19, 2021 · 5 comments
Open

[es2021] replaceAll no warning #496

hothvictor opened this issue Nov 19, 2021 · 5 comments

Comments

@hothvictor
Copy link

Already updated to the latest caniuse-lite version, but still no warning message.

Are there anyone have the same issue?

@Pochwar
Copy link

Pochwar commented Jan 26, 2022

Hi, yes I have the same issue, any news about it?

@mcMickJuice
Copy link

I am seeing this warning:

Screenshot 2023-11-13 at 10 50 01 AM

@tantian1498
Copy link

when I use: const statisticsStrTip = 'test'.replaceAll("", " "), it is useful;
but not useful when I use:
let statisticsStr = '-111_'
const statisticsStrTip = statisticsStr.replaceAll("_", " ")

what should I do?

@bartekleon
Copy link

bartekleon commented Jun 3, 2024

@mcMickJuice "anystring".replaceAll does work, but when you replace "anystring" with anyvariable it does not.

"".replaceAll("+", "-") // error

const a = ""
a.replaceAll("+", "-") // no error

image

@bartekleon
Copy link

bartekleon commented Jun 3, 2024

Issue seem to be here (helpers -> lintMemberExpression):
image

in case of "".replaceAll() it goes into if branch and gets String.replaceAll protochain.
in case of a.replaceAll() it goes to else branch and just passes through (protochain would be a.replaceAll).

From AST it doesn't know that a is a string.

Also it does flag String.replaceAll as issue (while it doesn't even exist) and doesn't flag String.prototype.replaceAll so there is no workaround afaik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants