Skip to content

Conversation

brettz9
Copy link
Collaborator

@brettz9 brettz9 commented Sep 23, 2025

feat(no-undefined-types): checkUsedTypedefs option; fixes #1165

@brettz9 brettz9 merged commit 001c4a9 into gajus:main Sep 24, 2025
4 checks passed
Copy link

🎉 This PR is included in version 60.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@stwlam
Copy link

stwlam commented Sep 27, 2025

I don't think this PR closes the linked issue, as it was seeking a way to verify that all imported @typedefs are used. Further, some JSDoc engines (such as typescript's) automatically export all @typedefs, making it a theoretic constant that none are unused within the file they're declared.

@brettz9
Copy link
Collaborator Author

brettz9 commented Sep 27, 2025

I don't think this PR closes the linked issue, as it was seeking a way to verify that all imported @typedefs are used.

As mentioned in this comment, it is not really possible for us to do that through ESLint currently (it only operates on a per-file basis). I'm not inclined for us to add our own file-reading/parsing mechanism. So the PR implements what is possible now.

Further, some JSDoc engines (such as typescript's) automatically export all @typedefs, making it a theoretic constant that none are unused within the file they're declared.

It depends on where they are scoped. If they are in the global scope, then yes, you are right. But the point is for those who want to use the typedef in some manner. It is not something everyone will want to use.

@stwlam
Copy link

stwlam commented Sep 27, 2025

I don't think this PR closes the linked issue, as it was seeking a way to verify that all imported @typedefs are used.

As mentioned in this comment, it is not really possible for us to do that through ESLint currently (it only operates on a per-file basis). I'm not inclined for us to add our own file-reading/parsing mechanism. So the PR implements what is possible now.

An @import is limited to the file the tag is in, at least.

@brettz9
Copy link
Collaborator Author

brettz9 commented Sep 27, 2025

I don't think this PR closes the linked issue, as it was seeking a way to verify that all imported @typedefs are used.

As mentioned in this comment, it is not really possible for us to do that through ESLint currently (it only operates on a per-file basis). I'm not inclined for us to add our own file-reading/parsing mechanism. So the PR implements what is possible now.

An @import is limited to the file the tag is in, at least.

So you want to file an issue to check for unused imports? TS checks for this already, btw...

@stwlam
Copy link

stwlam commented Sep 27, 2025

So you want to file an issue to check for unused imports? TS checks for this already, btw...

That one is using @import at all means javascript is in use (otherwise it'd be an import type). From there, one may or may not have or even want checkJs enabled.

@brettz9
Copy link
Collaborator Author

brettz9 commented Sep 27, 2025

So you want to file an issue to check for unused imports? TS checks for this already, btw...

That one is using @import at all means javascript is in use (otherwise it'd be an import type).

Of course. I was indeed speaking of checkJs checking.

From there, one may or may not have or even want checkJs enabled.

So you want to file an issue for cases where not using checkJs?

@stwlam
Copy link

stwlam commented Sep 27, 2025

Sure, will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An equivalent rule for unused imported @typedef similar to no-unused-vars
2 participants