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(lint/noUnusedImports): handle typeof of an imported type #566

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

Conaclos
Copy link
Member

@Conaclos Conaclos commented Oct 20, 2023

Summary

Fix #557

As indicated in the issue, typeof can be applied to both a value and an imported type.

import { type A, B } from "";
class C {};
interfcae D {}
typeof A; // valid `A` is an imported type
typeof B;
typeof C;
typeof D; // Invalid `D` is a type but is not imported.

Test Plan

New tests added.

@Conaclos Conaclos temporarily deployed to Website deployment October 20, 2023 12:37 — with GitHub Actions Inactive
@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 20, 2023
@Conaclos Conaclos requested a review from ematipico October 20, 2023 12:40
@github-actions
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 49701 49701 0
Passed 48642 48642 0
Failed 1059 1059 0
Panics 0 0 0
Coverage 97.87% 97.87% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6322 6322 0
Passed 2036 2036 0
Failed 4286 4286 0
Panics 0 0 0
Coverage 32.20% 32.20% 0.00%

ts/babel

Test result main count This PR count Difference
Total 662 662 0
Passed 592 592 0
Failed 70 70 0
Panics 0 0 0
Coverage 89.43% 89.43% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 17646 17646 0
Passed 13454 13454 0
Failed 4190 4190 0
Panics 2 2 0
Coverage 76.24% 76.24% 0.00%

@Conaclos Conaclos force-pushed the conaclos/noUnusedImports/557 branch from 2d3e733 to 3da533f Compare October 20, 2023 12:45
@github-actions github-actions bot added A-Website Area: website A-Changelog Area: changelog labels Oct 20, 2023
@Conaclos Conaclos temporarily deployed to Website deployment October 20, 2023 12:46 — with GitHub Actions Inactive
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Should we add a test case in the documentation, too?

@Conaclos
Copy link
Member Author

Conaclos commented Oct 20, 2023

Should we add a test case in the documentation, too?

I don't think so. Do you see some interest to add an example?

@ematipico
Copy link
Member

That's OK, just wanted to know if it's worth it.

@Conaclos Conaclos merged commit 2193230 into main Oct 20, 2023
18 checks passed
@Conaclos Conaclos deleted the conaclos/noUnusedImports/557 branch October 20, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter A-Website Area: website L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 noUnusedImports does not detect used types
2 participants