Parsing unicode regexes can cause strange behavior in Node 4 #8020
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
archived due to age
This issue has been archived; please open a new issue for any further discussion
bug
ESLint is working incorrectly
rule
Relates to ESLint's core rules
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
No errors
What actually happened? Please include the actual, raw output from ESLint.
This is happening because the
node.value
property of the regex literal node isnull
in Node 4, because unicode regular expressions don't exist in that version. As a result, the rule assumes that the node is anull
literal.The rule can be updated to check the
regex
property of the literal to make sure it's not a regular expression. However, I wonder if there is a better way to represent this at the parser level -- it seems unintuitive thatnode.type === 'Literal' && node.value === null
should match against anything other than anull
literal.The text was updated successfully, but these errors were encountered: