sweepline / eslint-plugin-unused-imports

Package to separate no-unused-vars and no-unused-imports for eslint as well as providing an autofixer for the latter.
MIT License
504 stars 21 forks source link

Why doesn't eslint-plugin-unused-imports detect an unused exported class? #90

Closed jon9090 closed 1 month ago

jon9090 commented 2 months ago

If I have export class MyClass {} and I don't import it anywhere in my project, why doesn't eslint-plugin-unused-imports detect it?

//foo.ts:
export class MyClass {}
zymotik commented 1 month ago

This will be very hard to debug without a bit more info. Do you have reproduction steps? Include tsconfig, eslint config and location of the file in your repo.

antfu commented 1 month ago

When you export anything, it automatically bails out the unused detection. ESLint is single-file-based analysing, and for such cases it would be hard to detect and not always desired (like if you are writing a library etc.)

I'd say this would be consider out-of-scope. Thanks for bringing up