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

Rule for unused imports #348

Open
steverep opened this issue Jan 13, 2024 · 0 comments
Open

Rule for unused imports #348

steverep opened this issue Jan 13, 2024 · 0 comments

Comments

@steverep
Copy link

The no-missing-imports rule is very helpful, but it would be nice to have a no-unused-imports rule to remove imports of components that are not used anywhere in the module's templates. This can easily happen when a previous version of a template might have used the element, but was subsequently removed and the author forgot to removed the import. Since components are most often side effect only imports, I don't know any other way to catch these errors other than manually.

Perhaps oversimplifying, I'm thinking the rule could, for each side effect only import:

  1. Examine for custom elements in the same manner as no-missing-imports, except only 1 module deep
  2. Fail the rule if all elements defined are unused. This would assume the module is not being imported for other side effects, but since I bet that is an edge case (and probably bad practice anyway), the user could simply @ts-ignore those false positives or only use the rule for warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant