SonarQube reports false unused imports in Vue3 Composition API

Hi,

I’ve recently created a new Vue 3 project and was playing around with the new script setup.
But SonarQube doesn’t seem to be able to match import in the script setup and its usage in the template.
In all my .vue using imports, SonarQube was giving false negative.

I’ve put a link below to the github repo to recreate the issue.

  • Scanner version : sonar-scanner-cli-4.6.2.2472-windows
  • Docker SonarQube version : 8.9.1.44547

Github repo : sonique

Thanks in advance for your time,

Victor GUEGAN

1 Like

Yep, same issue for me. Also reports issues when importing *.vue components.

I believe SonarQube uses vue-eslint-parser to report these things according to this link:
https://jira.sonarsource.com/browse/MMF-1441

According to their release notes, vue-eslint-parser has implemented support for Vue’s new <script setup> syntax on July 1:

Sonar devs, please update this dependency to support Vue’s new SFC syntax. You can find the rfc for it here:

Hello Victor, hello Ethan,

Thank you for your messages, and welcome to SonarSource community.

We are indeed raising false-positives on the code snippet you provided, the reason being the version of the vue.js parser we use which doesn’t support this new syntax of Vue.js Single File Components.

I created a ticket to keep track of this issue and address it as soon as possible.

Regards,
Yassin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.