-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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): add consistent-indexed-object-style
rule
#2401
feat(eslint-plugin): add consistent-indexed-object-style
rule
#2401
Conversation
This rule enforces (default) or disallows the use of the `Record` type instead of an index signature. Closes typescript-eslint#795
Thanks for the PR, @remcohaszing! 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. |
…efer-record and fixed tests
Codecov Report
@@ Coverage Diff @@
## master #2401 +/- ##
==========================================
- Coverage 92.83% 92.82% -0.02%
==========================================
Files 291 293 +2
Lines 9562 9612 +50
Branches 2678 2691 +13
==========================================
+ Hits 8877 8922 +45
- Misses 324 326 +2
- Partials 361 364 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
prefer-record
ruleonsistent-indexed-object-style
rule
onsistent-indexed-object-style
ruleconsistent-indexed-object-style
rule
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 your work!
a few comments
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts
Outdated
Show resolved
Hide resolved
…syntax The newly handled syntax isn’t valid TypeScript syntax, but the TypeScript parser does parse it and it’s passed to ESLint.
…tions `always` has been renamed to `record`. `never` has been renamed to `indexed-signature`.
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 your contribution!
I'm not sure if |
I do think the use of the word record in that proposal is confusing as it has a different meaning in TypeScript. However, I don’t think this causes ambiguity for this rule specifically. Also changing the default now that this has been released, would be a breaking change. |
This rule enforces (default) or disallows the use of the
Record
type insteadof an index signature.
Closes #795