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

linter.verify hangs if code contains \n and no-useless-escape is enabled #17

Open
knolleary opened this issue Jul 28, 2022 · 2 comments

Comments

@knolleary
Copy link

If the code that is passed to linter.verify contains \\n in a string, and no-useless-escape is enabled, the function hangs and cpu usage hits 100%.

Passing the exact same code through eslint (7.32.0) does not.

The following code can be used to reproduce:

const Linter = require('eslint4b');
const linter = new Linter();

var defaultConfig = {
    "env": {
        "es2021": true
    },
    "parserOptions": {
        "ecmaVersion": 12
    },
    "rules": {
        "no-useless-escape": "error",
    }
}

linter.verify('const a = "\\n"', defaultConfig)
@sarike
Copy link

sarike commented Dec 8, 2022

I have the save issue. And I found this only happens when parserOptions.ecmaVersion >= 11

@maxdavid
Copy link

maxdavid commented Feb 3, 2023

Same issue here too. Using it in a codemirror project. Any backslash within a string causes the linter to hang indefinitely.

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

3 participants