Skip to content
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

Analyze TypeScript code inside Vue.js single file components #1281

Closed
ndchelsea opened this issue Aug 8, 2019 · 9 comments · Fixed by #2471
Closed

Analyze TypeScript code inside Vue.js single file components #1281

ndchelsea opened this issue Aug 8, 2019 · 9 comments · Fixed by #2471
Assignees
Labels
mmf-1441 https://jira.sonarsource.com/browse/MMF-1441
Milestone

Comments

@ndchelsea
Copy link

I want to request a feature.
Currently SonarJS supports Javascript in VUE files (single file components), but Typescript is explicitly ignored (see #981)

Expected behavior
Typescript should be supported in the same manner that JS is rather than being skipped.

@vilchik-elena
Copy link
Contributor

Hi,
there is already this ticket to handle this feature https://jira.sonarsource.com/browse/MMF-1441
Yet I'm not sure when we will take care of it

@sirago
Copy link

sirago commented Nov 28, 2019

Any update on this?

@saberduck
Copy link
Contributor

no update yet, it's on our radar. Also, you don't need to ping us, if there is any update you will see it either here or on the linked JIRA ticket

@fergardi
Copy link

I'm looking forward this feature as well. We've got several VueJS + Typescript projects and more on the road, and this will be a life saver for our client's code quality requirements.

It has been a while since the last comment on this ticket.

Any news so far? Or any workaround I could take advantage of meanwhile?

Thanks in advance for your great work.

@yannick-milanetto
Copy link

yannick-milanetto commented Nov 2, 2020

@fergardi The only workaround i've found so far is to put the typescript code in a dedicated TS file, and to reference it from the Vue file with : <script lang="ts" src="./myComponent.ts" />

Given the adoption of Typescript nowadays, it's a shame this has not been addressed by the Sonar team :(

@Saganic
Copy link

Saganic commented Dec 8, 2020

@fergardi The only workaround i've found so far is to put the typescript code in a dedicated TS file, and to reference it from the Vue file with : <script lang="ts" src="./myComponent.ts" />

Given the adoption of Typescript nowadays, it's a shame this has not been addressed by the Sonar team :(

This does bypass the issue with TypeScript SFCs but will introduce warnings about content:
DEBUG: Not enough content in 'src/modules/myModule/myComponent.vue' to have CPD blocks, it will not be part of the duplication detection

The other thing with this approach is that it really does break the mantra of having SFCs in the first place. All of your component's code in the same place etc.

Is there any update on when full support for TypeScript in SFCs will be added?

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource changed the title Typescript not supported in .vue files Analyze TypeScript code inside Vue.js single file components Jan 29, 2021
@yassin-kammoun-sonarsource yassin-kammoun-sonarsource added this to the 7.2 milestone Jan 29, 2021
@yassin-kammoun-sonarsource
Copy link
Contributor

The support for TypeScript in Vue.js single file components is planned for SonarJS 7.2.

@agigleux
Copy link
Member

This feature is available on SonarCloud.io

@304NotModified
Copy link

304NotModified commented May 4, 2022

@agigleux

Is this also supported now in SonarQube (and which version?)

(I see its 7.2 - But I don't know where to find the used version of this plugin in SonarQube enterprise. Is it somewhere in an admin panel or the logs?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mmf-1441 https://jira.sonarsource.com/browse/MMF-1441
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants