Vue3 false positive: S1128 "Unnecessary imports should be removed"

We started using the new script setup syntactic sugar in Vue3 and this started creating a lot of false positive unnecessary imports issues. Which makes sense, but is still a false positive :slight_smile:

Namely, the imports are now automagically available in the without having to explicitly return them in the - which means that within the scope, the import is just imported and never mentioned - so the error.

I think in single file components this should be an easy to fix, just check within the to see if the import is used.

I am also hoping you guys can find a way to also check the the when the is in a separate file?

Hello Predrag,

Thank you for your feedback.

We are aware of this new syntactic sugar in Vue.js 3.0, and we already attempted to fix these false-positives using some kind of heuristic (see here). Since you are still facing these issues, we may have missed a few corner cases here and there.

Therefore, I would appreciate if you could share a minimal, reproducible example as well as which product, version you are using (SonarQube, SonarCloud, SonarLint).

Thank you,
Yassin