False positive: Remove this unused import of with Vue.js

Hi SonarTeam,

we have a mass of false positives in “Unnecessary imports should be removed typescript:S1128” in our Quality-Gate issues list.

Mainly caused in Vue 3 Single-File-Components with <script setup> and TypeScript, e.g.:

Version: SonarQube Server Developer Edition v2025.1 (102418)
Deployed via Docker

I use VSCode with Connected Mode to SonarQube, so I see these errors everywhere during development also.

Is there a way to fix this?

Best Regards,
ElSuture

Hi ElSuture,

Can we have a text reproducer? I’m looking to be able to copy/paste a code snippet into a file to get this same issue.

 
Thx,
Ann

Hi Ann,

I forgot to mention that we use Pug in our project, so maybe there is the problem..

I can’t share our work repository, but I have created a similar one here Vue 3 Project with Quasar, Pug, and UI Components - StackBlitz for reproduction. It should have the same errors

Best regards,
ElSuture

1 Like

Hi ElSuture,

Thanks for the reproducer! I’ll flag this for the language experts.

 
Ann

Hi @ElSuture,

I think you are right, it is due to using pug, which we currently do not support. We currently do not parse the <template> tag.

I will re-assign to @gab to keep this in mind.

Kind regards,
Michal

Hi,

Do you plan to support Pug?
We also use pug in Vue3 single file components, and we are also getting hundreds of false positive Unnecessary Import errors.

Cheers,
Rich

Hi everyone,

I have added this to our internal tracker to keep Pug + Vue3 file components in our radar.

If this particular rule is not helpful, you can disable it from the Quality Profile or in SonarQube IDE.

2 Likes

@gab when are you going to implement this?

Hi @ElSuture, there’s no commitment, we are tracking interest for now!