eslint4b icon indicating copy to clipboard operation
eslint4b copied to clipboard

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

Open knolleary opened this issue 2 years ago • 2 comments

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)

knolleary avatar Jul 28 '22 19:07 knolleary

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

sarike avatar Dec 08 '22 07:12 sarike

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

maxdavid avatar Feb 03 '23 22:02 maxdavid