Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(eslint-plugin): [prefer-readonly] report if a member's property is reassigned#6043
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix(eslint-plugin): [prefer-readonly] report if a member's property is reassigned#6043
Conversation
nx-cloudbot commentedNov 19, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks for the PR,@islandryu! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedNov 19, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site settings. |
codecovbot commentedNov 19, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@## main #6043 +/- ##======================================= Coverage 91.27% 91.28% ======================================= Files 366 366 Lines 12362 12363 +1 Branches 3616 3617 +1 =======================================+ Hits 11284 11285 +1 Misses 768 768 Partials 310 310
Flags with carried forward coverage won't be shown.Click here to find out more.
|
JoshuaKGoldberg left a comment
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.
Code change looks great to start, thanks for sending this in@islandryu! 🙌 Just requesting changes for a bit more test coverage.
| messageId:'preferReadonly', | ||
| }, | ||
| ], | ||
| }, |
JoshuaKGoldbergNov 19, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 few more test cases to consider...
this.testObj.prop;this.testObj?.prop;this.testObj!.prop;this.testObj!.prop='';this.testObj.prop.prop='';this.testObj.prop.doesSomething();this.testObj?.prop.prop;this.testObj?.prop?.prop;this.testObj.prop?.prop;this.testObj!.prop?.prop;
For any change to rule logic, it's generally good to try to add bothvalid andinvalid test cases.
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.
@islandryu by "test cases" I do mean cases plural - we generally try to keep these separate, so that each test case tests one case. It's easy to miss incorrect or mismatched errors when they're all lumped together. Could you split them up please?
islandryu commentedNov 21, 2022
@JoshuaKGoldberg |
JoshuaKGoldberg left a comment
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.
Sorry, I might not have been very clear - I'm hoping for quite a few cases to test this. It's a behavior that has a lot of edge cases we should test for individually. Thanks!
| messageId:'preferReadonly', | ||
| }, | ||
| ], | ||
| }, |
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.
@islandryu by "test cases" I do mean cases plural - we generally try to keep these separate, so that each test case tests one case. It's easy to miss incorrect or mismatched errors when they're all lumped together. Could you split them up please?
islandryu commentedNov 26, 2022
@JoshuaKGoldberg |
JoshuaKGoldberg left a comment
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.
Yup, this is great - thanks for sending this in! 🙌
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
Overview