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
Update: improve null detection in eqeqeq for ES6 regexes (fixes #8020) #8042
Conversation
@not-an-aardvark, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mysticatea, @gyandeeps and @platinumazure to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-thought this.
node.raw
property does not exist in ESTree spec.
Can we use it safely?
Oh, I hadn't realized that. I suppose I can check |
4abb3a7
to
1d0e307
Compare
LGTM |
What is the purpose of this pull request? (put an "X" next to item)
[x] Bug fix (see #8020)
What changes did you make? (Give an overview)
This fixes the detection of
null
literals ineqeqeq
, to prevent it from treating unicode/sticky regexes likenull
in Node 4. When parsing values that cannot be represented in the current environment (e.g. unicode regexes in Node 4), the result is aLiteral
node withnode.value === null
. Theeqeqeq
rule assumed that any literal node withnode.value === null
is anull
literal.This also adds a
isNullLiteral
function toast-utils.js
to prevent other rules from making the same mistake.Is there anything you'd like reviewers to focus on?
Nothing in particular