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

Infinite loop with "no-useless-escape" rule #8

Open
ota-meshi opened this issue Feb 25, 2021 · 1 comment
Open

Infinite loop with "no-useless-escape" rule #8

ota-meshi opened this issue Feb 25, 2021 · 1 comment

Comments

@ota-meshi
Copy link

I have confirmed with eslint4b v7.20.0.

The following source code is the source code for at 25,907 line of the eslint4b/dist/core-rules.js file causing the infinite loop.

        while (match = /\\[^\d]/gu.exec(value)) {
          validateString(node, match);
        }

In the original source code, the regular expression correctly uses one instance, so it doesn't go into an infinite loop.

https://github.com/eslint/eslint/blob/87c43a5d7ea2018cffd6d9b5c431ecb60caaf0d6/lib/rules/no-useless-escape.js#L210-L215

                const pattern = /\\[^\d]/gu;
                let match;

                while ((match = pattern.exec(value))) {
                    validateString(node, match);
                }

I think it's probably a build system bug, but I opened an issue here because I don't know which build system is wrong.

@ota-meshi
Copy link
Author

Maybe a bug in babel-plugin-minify-dead-code-elimination, but it doesn't seem to be fixed yet.

babel/minify#981

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

1 participant