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
Fix: no-invalid-this
false positive (fixes #6824)
#6827
Conversation
@mysticatea, thanks for your PR! By analyzing the annotation information on this pull request, we identified @kevinoid, @nzakas and @nre to be potential reviewers |
LGTM |
LGTM, but waiting for others to review. |
@@ -11,12 +11,13 @@ Basically this rule checks whether or not a function which are containing `this` | |||
This rule judges from following conditions whether or not the function is a constructor: | |||
|
|||
* The name of the function starts with uppercase. | |||
* The function is assigned to a variable the name starts with uppercase. |
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.
Small grammar improvement if you're interested: "The function is assigned to a variable which starts with an uppercase letter."
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.
Thank you for correction!
Just one or two small things, otherwise LGTM. Thanks for turning this around so quickly! |
LGTM, excluding existing comments. Nice work @mysticatea! |
LGTM |
I modified those. |
LGTM. Thanks @mysticatea! |
LGTM, thanks! |
LGTM 👍 |
Fixes #6824.
This PR fixes the false positive of
no-invalid-this
rule. (reduces warnings)If an anonymous function is assigned to a variable that the name starts with uppercase, the rule comes to handle the function as a constructor (i.e.
this
in the function is valid.).This is similar to an existing behavior; a function that the name starts with uppercase is handled as a constructor.