-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [consistent-indexed-object-style] convert readonly index signature to readonly record #2798
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(eslint-plugin): [consistent-indexed-object-style] convert readonly index signature to readonly record #2798
Conversation
…ype to correct code examples
Thanks for the PR, @ryym! 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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
Codecov Report
@@ Coverage Diff @@
## master #2798 +/- ##
=======================================
Coverage 92.80% 92.80%
=======================================
Files 300 300
Lines 9857 9859 +2
Branches 2769 2770 +1
=======================================
+ Hits 9148 9150 +2
Misses 332 332
Partials 377 377
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.
Couldn't we fix this to Readonly<Record<string, unknown>>
instead of just ignoring it?
Good idea! |
…adonly type to correct code examples" This reverts commit 3212edb. The rule should replace a readonly index signature with `Readonly<Record>` instead of ignoring it.
…ly index signature to Readonly Record type This replaces the fix of 816b1bb. Instead of just ignoring the readonly index signature, replace it with `Readonly<Record<key, value>>` type.
@bradzacher Thank you for your advice. |
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 for working on this!
Fixes #2797
Update the rule to skip readonly index signature.Update the rule document.Update the rule to fix a readonly index signature by
Readonly<Record<key, value>>
type.(#2798 (review))