-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Feature Request - Show unused imports TypeScript #1063
Comments
I am looking for the same feature! Would help a lot! |
This would help our team too. |
Have you tried adding |
Depends on #682. We are using TS 2.8 still and it doesn't have this feature yet. |
Blocked by microsoft/language-server-protocol#500. |
@octref Do we need |
No, |
Ok. Thanks a lot for this new feature! |
@octref It doesn't seem to work in v0.18.0 with <script lang="ts">. |
Does not work on my side too. I don't understand why... |
@mengdi @superheri Can you use either https://github.com/octref/veturpack or vue-cli to create a minimal reproducible example? |
In my big project at work with ~1250 files of JS/TS/Vue it can't seem to work. But in veturpack it seems to work though. I found a way to produce a bug with veturpack by changing the file <template>
<div class="page">
<counter></counter>
</div>
</template>
<script lang="ts">
import Counter from 'components/Counter'
import * as _ from 'lodash';
export default {
components: {
Counter
}
}
</script> As we can see in this image (You can use it at the same time as a proof I use Vetur 0.18.0) : In this case even if we are not using the declared I will try hard to reproduce more cases. I'll keep you updated with this. EDIT : I just realized |
Hmm, I just realized that this works:
When using bundled TS 3.3 this breaks. |
I see the problem. |
We are looking at two issues here:
|
After testing and trying a way to reproduce the bug I have with my big project, I can't find a way to reproduce it on a minimalist case. Maybe it is a mix of multiple fonctionnalities that creates this bug. Or because it is so slow on big projects that Vetur become unstable. |
This issues is not resolved for us. We are using |
Please create a repro case and open new issues. |
Yeah, this feature doesn't work.... What is the actual resolution here? A reproduction case is literally any project with any .vue file that uses typecript. At least in my experience thus far. |
I can confirm this problems still happens to me. I haven't used Vetur in about a year, but when I got back to it some weeks ago, the problem was there... Seems like a regression at some point. Would be great if it could be fixed... |
Still does not work in 2021 😢 |
And it likely won't for you in 2022 if people continue to ignore requests by the maintainer for a reproduction. It seems to work in most cases - works for me, for example. That's also why the issue is closed. It seems, from what you folks indicate, to break under certain condition - conditions that you, the ones experiencing the problem, have to enable the maintainer to understand and reproduce. So coming here and posting sad smiley will not help us fix this. |
the default tsconfig in vue-cli projects isn't set up to report unused locals. just set it to do so (typescript docs will help you with that). still not a bug. |
So the expected behavior is that it does not work without configuring |
You can use eslint for that too |
In my case ESLint without |
Please open a new issue and provide a repro case next time. I slove this problem in next version, because I just understand this problem. |
Info
Problem
Unused imports are not shown in Vue Files like it is in VS Code TypeScrfipt files. Would be nice to have this to know which imports are not used and can be removed.
In a TS file :
In a Vue file :
Even if I never used lodash in my code the import is still shown the same color as other imports unlike in TS files.
Reproducible Case
Add whatever imports in a Vue files and don't use them.
The text was updated successfully, but these errors were encountered: