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

fix(eslint-plugin): handle error classes using generics #1428

Merged
merged 2 commits into from Jan 10, 2020

Conversation

a-tarasyuk
Copy link
Contributor

Fixes #1427

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @a-tarasyuk!

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 Jan 10, 2020

Codecov Report

Merging #1428 into master will not change coverage.
The diff coverage is 80.85%.

@@           Coverage Diff           @@
##           master    #1428   +/-   ##
=======================================
  Coverage   94.47%   94.47%           
=======================================
  Files         141      141           
  Lines        6060     6060           
  Branches     1721     1721           
=======================================
  Hits         5725     5725           
  Misses        182      182           
  Partials      153      153
Impacted Files Coverage Δ
...nt-plugin/src/rules/no-unused-vars-experimental.ts 91.39% <ø> (ø) ⬆️
...slint-plugin/src/rules/no-unnecessary-qualifier.ts 96.15% <ø> (ø) ⬆️
...ages/eslint-plugin/src/rules/prefer-regexp-exec.ts 100% <ø> (ø) ⬆️
.../eslint-plugin/src/rules/promise-function-async.ts 100% <ø> (ø) ⬆️
...slint-plugin/src/rules/no-unnecessary-condition.ts 99.01% <ø> (ø) ⬆️
...-plugin/src/rules/restrict-template-expressions.ts 100% <ø> (ø) ⬆️
...plugin/src/rules/prefer-string-starts-ends-with.ts 100% <ø> (ø) ⬆️
packages/typescript-estree/src/ts-estree/index.ts 100% <ø> (ø) ⬆️
.../eslint-plugin/src/rules/restrict-plus-operands.ts 100% <ø> (ø) ⬆️
...pt-estree/src/ts-estree/estree-to-ts-node-types.ts 0% <0%> (ø) ⬆️
... and 29 more

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 the quick turnaround

@@ -39,7 +43,7 @@ export default util.createRule({
}
}

const baseTypes = type.getBaseTypes() ?? [];
const baseTypes = checker.getBaseTypes(type as ts.InterfaceType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting. Maybe we should add a lint rule against using type.getBaseTypes(), considering it fails in generic cases.

@bradzacher bradzacher added the bug Something isn't working label Jan 10, 2020
@bradzacher bradzacher merged commit b139540 into typescript-eslint:master Jan 10, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[no-throw-literal] False positive for custom Error classes using generics (templates)
2 participants