Javascript parse fail if I use decorator for property in classes

59 views
Skip to first unread message

voxuanth...@gmail.com

unread,
Dec 6, 2016, 2:59:53 AM12/6/16
to SonarQube
I use Mobxjs Decorator in my react application (http://mobxjs.github.io/mobx/refguide/observable-decorator.html)
import {observable} from "mobx";

class OrderLine {
    @observable price = 0;
    @observable amount = 1;

    constructor(price) {
        this.price = price;
    }

    @computed get total() {
        return this.price * this.amount;
    }
}
When sonar-scanner run, It report an Error:
ERROR: Unable to parse file: /data/app/dropdown.js
It report that could not parse line: @observable price = 0;. Synxtax is Invalid. 
Anyone help me?

Elena Vilchik

unread,
Dec 6, 2016, 4:37:15 AM12/6/16
to SonarQube, voxuanth...@gmail.com
Hello,

Thanks for feedback! I've created a ticket https://jira.sonarsource.com/browse/SONARJS-841 to fix it.

Elena VILCHIK | SonarSource
Language Team
Reply all
Reply to author
Forward
0 new messages