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

@remcohaszing remcohaszing commented Aug 18, 2020

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 #795
@typescript-eslint
Copy link

@typescript-eslint typescript-eslint bot commented Aug 18, 2020

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
Copy link

@codecov 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

thanks for your work!
a few comments

…eText
…e types
…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`.
…more type safe
…x error
Copy link
Member

@bradzacher bradzacher left a comment

LGTM - thanks for your contribution!

@bradzacher bradzacher merged commit d7dc108 into typescript-eslint:master Sep 28, 2020
10 checks passed
10 checks passed
Typecheck
Details
Unit tests Unit tests
Details
Code style and lint
Details
Run integration tests on primary Node.js version
Details
Run unit tests on other Node.js versions (10.x)
Details
Run unit tests on other Node.js versions (14.x)
Details
Publish the latest code as a canary version
Details
Semantic Pull Request ready to be squashed
Details
codecov/patch Codecov Report
Details
codecov/project Codecov Report
Details
@kripod
Copy link
Contributor

@kripod 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

@remcohaszing remcohaszing commented Oct 6, 2020

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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants