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 no-unnecessary-type-constraint rule #2516

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Sep 8, 2020

Fixes #2107.

If a type parameter inside a type parameter declaration includes a constraint and that constraint includes the Any or Unknown flag, that's an error.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

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

codecov bot commented Sep 8, 2020

Codecov Report

Merging #2516 into master will decrease coverage by 0.06%.
The diff coverage is 91.78%.

@@            Coverage Diff             @@
##           master    #2516      +/-   ##
==========================================
- Coverage   92.81%   92.75%   -0.07%     
==========================================
  Files         290      296       +6     
  Lines        9453     9739     +286     
  Branches     2647     2733      +86     
==========================================
+ Hits         8774     9033     +259     
- Misses        322      332      +10     
- Partials      357      374      +17     
Flag Coverage Δ
#unittest 92.75% <91.78%> (-0.07%) ⬇️

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% <ø> (ø)
...int-plugin/src/rules/consistent-type-assertions.ts 86.48% <ø> (ø)
...nt-plugin/src/rules/lines-between-class-members.ts 85.71% <ø> (ø)
...-plugin/src/rules/no-unnecessary-type-assertion.ts 97.10% <ø> (ø)
...plugin/src/rules/prefer-string-starts-ends-with.ts 97.86% <ø> (ø)
...ges/experimental-utils/src/ts-eslint/RuleTester.ts 100.00% <ø> (ø)
packages/eslint-plugin/src/rules/dot-notation.ts 84.21% <66.66%> (-2.46%) ⬇️
...ackages/eslint-plugin/src/rules/no-implied-eval.ts 93.75% <66.66%> (-2.81%) ⬇️
.../eslint-plugin/src/rules/method-signature-style.ts 87.20% <78.04%> (-5.65%) ⬇️
...es/eslint-plugin/src/rules/no-use-before-define.ts 92.50% <80.00%> (-1.87%) ⬇️
... and 33 more

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review September 8, 2020 02:18
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.

the logic itself LGTM - a few minor comments.
Thanks for working on this

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Sep 28, 2020
@bradzacher bradzacher changed the title feat(eslint-plugin): add no-unnecessary-type-constraint rule feat(eslint-plugin): add no-unnecessary-type-constraint rule Sep 28, 2020
@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed awaiting response Issues waiting for a reply from the OP or another party labels Oct 2, 2020
@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Oct 11, 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.

one last minor comment then we're good to go!

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Oct 18, 2020
This was referenced Oct 26, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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: consistent empty generic constraints
2 participants