-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): [member-ordering] add support for grouping readonly fields #6349
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 support for grouping readonly fields #6349
Conversation
Thanks for the PR, @IronGeek! 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 #6349 +/- ##
==========================================
+ Coverage 88.62% 91.28% +2.65%
==========================================
Files 382 366 -16
Lines 12883 12461 -422
Branches 3787 3656 -131
==========================================
- Hits 11418 11375 -43
+ Misses 1124 772 -352
+ Partials 341 314 -27
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 good start - thanks for getting this PR up! 🙌
Requesting changes on more test coverage & handling index signatures.
Aside: this rule gets more complicated and hard to deal with in every PR. But I don't see a way around it 😞. This comment isn't actionable and you can ignore my sadness. I'm just ... musing.
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.
Whew, looks good to me! Thanks @IronGeek! 🙌
In theory one might want something like readonly-method
, for cases like { readonly A: () => void }
. But that can be a feature add if requested after this PR. The rule is (and already was) complex enough as it is.
Btw, sorry for the month-long wait time. This fell off my radar. After the v6 release I'm hopeful we can work on #6033 as a process improvement so it doesn't happen again. |
PR Checklist
Overview
This PR introduces new member attribute/type/Kind:
readonly-field
, a superset offield
, which denotes all fields with readonly modifiers. This makes it possible to group/ sort fields based on their readonly modifiers and optionally with their Accessibility, and or Scope too.Like other member types,
readonly-field
can also be joined with accessibility and scope attributes to create more specific type; the following is the complete combination ofreadonly-field
with Scope and Accessibility introduced in this PR:For example, with this configuration the following code would be treated as valid: