Skip to content

feat(no-undefined-types): checkUsedTypedefs option - #1544

Merged
brettz9 merged 1 commit into
gajus:mainfrom
brettz9:no-unused-typedefs
Sep 24, 2025
Merged

feat(no-undefined-types): checkUsedTypedefs option#1544
brettz9 merged 1 commit into
gajus:mainfrom
brettz9:no-unused-typedefs

Conversation

@brettz9

@brettz9 brettz9 commented Sep 23, 2025

Copy link
Copy Markdown
Collaborator

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

@brettz9
brettz9 merged commit 001c4a9 into gajus:main Sep 24, 2025
4 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 60.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@stwlam

stwlam commented Sep 27, 2025

Copy link
Copy Markdown

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

brettz9 commented Sep 27, 2025

Copy link
Copy Markdown
Collaborator Author

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

stwlam commented Sep 27, 2025

Copy link
Copy Markdown

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

brettz9 commented Sep 27, 2025

Copy link
Copy Markdown
Collaborator Author

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

stwlam commented Sep 27, 2025

Copy link
Copy Markdown

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

brettz9 commented Sep 27, 2025

Copy link
Copy Markdown
Collaborator Author

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

stwlam commented Sep 27, 2025

Copy link
Copy Markdown

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