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: Add capIsConstructor option to no-invalid-this (fixes #12271) #12308
Conversation
Seems like GitHub macOS is going to fail again. |
I can't see what exactly failed this time, seems that Test didn't even start after 48 min. What could we do about this? |
I’ll submit a support ticket and see if GitHub can help us. Seems strange that this only happens in macOS and that the reason for failure seems so inconsistent. |
0ca98b4
to
7ca0cd5
Compare
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, thanks!
What is the purpose of this pull request? (put an "X" next to item)
[X] Changes an existing rule #12271
What rule do you want to change?
no-invalid-this
Does this change cause the rule to produce more or fewer warnings?
More if the option is set to
false
(default istrue
).How will the change be implemented? (New option, new default behavior, etc.)?
New option.
Please provide some example code that this change will affect:
What does the rule currently do for this code?
No errors.
What will the rule do after it's changed?
4 errors.
Setting the option to
false
means that functions which name starts with an uppercase (or are assigned to such variables) are just regular functions, not constructor functions.What changes did you make? (Give an overview)
Implemented the new option.
Is there anything you'd like reviewers to focus on?
astUtils.isDefaultThisBinding
signature. This looked to me like a good case for an options object and default value, but both are not used much in the codebase so I'm not sure is it okay?Also I couldn't find existing tests for the function, I guess it would be too complex to do that directly and that the rules' tests are good enough.