Skip to content

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

@knolleary

Description

@knolleary

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions