Skip to content
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

Merged
merged 11 commits into from Sep 28, 2020

Conversation

remcohaszing
Copy link
Contributor

This rule enforces (default) or disallows the use of the Record type instead
of an index signature.

Closes #795

This rule enforces (default) or disallows the use of the `Record` type instead
of an index signature.

Closes typescript-eslint#795
@typescript-eslint
Copy link
Contributor

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.

@bradzacher bradzacher added the enhancement: new plugin rule New rule request for eslint-plugin label Aug 18, 2020
@codecov
Copy link

codecov bot commented Aug 19, 2020

Codecov Report

Merging #2401 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            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     
Flag Coverage Δ
#unittest 92.82% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/eslint-plugin/src/configs/all.ts 100.00% <ø> (ø)
...lugin/src/rules/consistent-indexed-object-style.ts 90.24% <ø> (ø)
...slint-plugin/src/rules/no-unnecessary-condition.ts 97.14% <0.00%> (ø)
packages/eslint-plugin/src/util/propertyTypes.ts 88.88% <0.00%> (ø)

@remcohaszing remcohaszing changed the title feat(eslint-plugin): add prefer-record rule feat(eslint-plugin): add onsistent-indexed-object-style rule Aug 21, 2020
@remcohaszing remcohaszing changed the title feat(eslint-plugin): add onsistent-indexed-object-style rule feat(eslint-plugin): add consistent-indexed-object-style rule Aug 21, 2020
Copy link
Member

@bradzacher bradzacher left a 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

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Sep 21, 2020
@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Sep 27, 2020
@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Sep 28, 2020
…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`.
Copy link
Member

@bradzacher bradzacher left a 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!

@bradzacher bradzacher merged commit d7dc108 into typescript-eslint:master Sep 28, 2020
@kripod
Copy link
Contributor

kripod commented Oct 6, 2020

I'm not sure if Record is a good default, as it might cause ambiguity with the progressing Records & Tuples language proposal.

@remcohaszing
Copy link
Contributor Author

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting response Issues waiting for a reply from the OP or another party enhancement: new plugin rule New rule request for eslint-plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule proposal: Enforce dictionary type style
3 participants