Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript analysis fail for .js files containing ES7 Decorators

I'm currently using Babel (the Javascript transpiler) which allows me to use the future syntax now. I'm using the decorator functionality (https://github.com/wycats/javascript-decorators). However when I run analysis on that code, SonarQube throws the following error:

[09:19:43] 09:19:43.693 ERROR - Unable to parse file: /...../my-form.js 09:19:43.693 ERROR - Parse error at line 10 column 1:

1: import {View, Component, Inject, NgScope} from 'app/app';
...
9: 
10: @Component({
    ^
11:   selector: 'my-form'
12: })
13: @View({
14:   template: myTemplate
15: })

Will this be covered soon by the Javascript plugin (or at least skipped by the parser but allowing it to continue processing of the file)?. Is there a way to file a JIRA issue for this?

like image 683
Adrian Mitev Avatar asked Oct 20 '22 03:10

Adrian Mitev


1 Answers

From the SonarQube user group:

Regarding the support of the decorator construction, it will not be supported by the JavaScript plugin as long as it will not be part of the ECMAScript Standard. Moreover when the JavaScript plugin is not able to parse a file the analysis should not fail, it should succeed but no issue will be reported on the unparsed file.

However there is already a JIRA ticket where you can vote up to show them the need for this feature.

JIRA - Support experimental JavaScript features

like image 86
Custodio Avatar answered Oct 22 '22 21:10

Custodio