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: support globalThis (refs #12670) #12774
Merged
Merged
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c0357bc
support globalThis in no-alert (ref #12670)
yeonjuan 2db8bec
support globalThis in no-eval (ref #12670)
yeonjuan d3847f2
bump eslint-utils to ^2.0.0 (ref #12670)
yeonjuan a5a6504
add globalThis test cases in require-unicode-regexp (ref #12670)
yeonjuan b2db2b5
add globalThis test cases in prefer-regex-literals (ref #12670)
yeonjuan 4252206
add globalThis test cases in prefer-object-spread (ref #12670)
yeonjuan dd669b7
add globalThis test cases in prefer-named-capture-group (ref #12670)
yeonjuan 069f1be
add globalThis test cases in prefer-exponentiation-operator (ref #12670)
yeonjuan 0621dc6
add globalThis test cases in no-misleading-character-class (ref #12670)
yeonjuan cbc26e7
edit test cases in no-eval
yeonjuan 1847241
merge upstream
yeonjuan 130c1c3
support globalThis in no-obj-calls (ref #12670)
yeonjuan 771e4bc
add globalThis test cases in no-redeclare (#12670)
yeonjuan 309b019
change to use getPropertyName
yeonjuan 1361436
fix tpo
yeonjuan b469eaa
merge upstream
yeonjuan 116517d
merge upstream
yeonjuan 4b41842
add messageID - unexpectedRefCall
yeonjuan File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks for fixing this bug!
Current behavior (demo):
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.
A question, maybe we could use
path
from iterateglobalreferences?I guess it depends on whether we want to report "JSON is not a function" or "foo is not a function" in cases such as the following:
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.
Ok, I'll try it! :) But what would be a better report?
In my personal opinion, current behavior looks better. But I respect what eslint members think
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'm not sure, let's wait for more opinions.
Current behavior reports "foo is not a function".
I'd vote for "JSON is not a function" as it might be a bit more helpful for the user to find out what's actually happening and why is the location of "foo()" reported as a global object call.
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.
Ok. And just to note.
The reason for my preference was that
foo is not a function
looks like a more intuitive explanation for the code.But I agree that
JSON is not a function
is more helpful to find out what's actually happening. it seems more reasonable 👍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.
Could we do both? "foo is a reference to JSON, which is not a function"? That seems like it gives the right amount of information without being too confusing or requiring you to figure out what the code is doing.
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.
That would be ideal!
I'd be also fine with "foo is not a function" in this PR (it's already much better than "undefined is not a function") and improving the message further in another PR.
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.
Agree! it would make the message more clear. maybe it needs new messageId like -
unexpectedRefCall
. I will do it. thanks :)