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
Contributor

@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

@typescript-eslint typescript-eslint bot commented Sep 8, 2020

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.

@JoshuaKGoldberg JoshuaKGoldberg force-pushed the JoshuaKGoldberg:no-unnecessary-type-constraint branch from e0ee9ae to 23e14f2 Sep 8, 2020
@codecov
Copy link

@codecov 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 force-pushed the JoshuaKGoldberg:no-unnecessary-type-constraint branch from 23e14f2 to 592e282 Sep 8, 2020
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review Sep 8, 2020
Copy link
Member

@bradzacher bradzacher left a comment

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

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

@bradzacher bradzacher left a comment

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

@bradzacher bradzacher merged commit 880ac75 into typescript-eslint:master Oct 26, 2020
8 checks passed
8 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
@JoshuaKGoldberg JoshuaKGoldberg deleted the JoshuaKGoldberg:no-unnecessary-type-constraint branch Oct 26, 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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.