-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat(eslint-plugin): [member-ordering] add a required option for required vs. optional member ordering #5965
Conversation
…which ensures that all required members appear before all optional members.
…redMember to be slightly faster and adding jsdoc comments for it and isMemberOptional.
Thanks for the PR, @asdf93074! 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 on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5965 +/- ##
==========================================
+ Coverage 91.24% 91.27% +0.02%
==========================================
Files 366 366
Lines 12380 12417 +37
Branches 3621 3631 +10
==========================================
+ Hits 11296 11333 +37
Misses 774 774
Partials 310 310
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…d which takes first or last as a value and adding functionality to check order based on both of these along with additional tests.
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 sending this in @asdf93074! I'm excited to get this feature in. 🎉
There's a lot of changed code in this PR and the member-ordering
rule is already a lot of lines. We should be able to trim the changes down a bit to be easier to read & review. I can take a deeper look once the refactors are done. Let me know if anything's unclear or not right!
…nother test case.
…and removing unused code.
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 making the changes @asdf93074! I actually personally find this a good deal easier to read, but maybe that's just my personal preference. If another maintainer wants to weigh in that'd be good too 😄 - I'm nervous about stomping over perfectly good code. (and to be fair, yours did work quite well before too!)
Just requesting changes on a bit more testing. Otherwise this looks good to me!
…coverage for isMemberOptional function.
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.
Fantastic, this is looking great. Thanks for sending this in and iterating on it with me @asdf93074! 🙌
I'll leave this open for a bit in case another maintainer wants to poke at it or suggest an alternative API name (which we can apply ourselves if you don't want to keep receiving extra work because of our indecision 😅). But I've set a reminder to merge it this weekend if nobody requests changes, so it'll be available in our next stable version. Edit: see #5965 (comment), will go on Monday! |
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.
🙌
PR Checklist
Overview
Added a new property required to SortedOrderConfig.
Added a corresponding error message id for when a rule fails because of required being set to 'first' or 'last'.
If required is 'first', then before any sorting/grouping configurations, we ensure that the members array has all its required items first and all optional items afterwards. Afterwards, we perform the remaining sorting/grouping checks on the required subset and the optional subset.