Parsing error: Invalid regular expression: /\p{Lu}/: Invalid escape (Unicode general category properties)

Viewed 461

ESLint 7.0.0 appears to have a problem with Unicode general category properties in regular expressions.

In one file, I'm getting this error message:

Parsing error: Invalid regular expression: /\p{Lu}/: Invalid escape

I'm getting it in other files as well, but this is the most simple expression on which I'm getting it.

It's a valid expression. Works just fine when I run the code. But it's breaking my ESLint run.

What setting do I use to get ESLint to accept these expressions?

1 Answers

Problem seems to disappear by adjusting .eslintrc.json slightly:

"parserOptions": {
    "ecmaVersion": 2019
}
Related