Failed to parse file .jsx with Unexpected character '@'

  • sonarqube: using sonarcloud.io
  • CI system used: gitlab
  • Scanner command used when applicable:
sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.branch.name=$CI_COMMIT_BRANCH -X
  • Languages of the repository: javascript, typescript
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
Failed to parse file [EmptyCache.jsx] at line 10: Unexpected character '@'
  • sonar-scanner: it is from docker image (sonarsource/sonar-scanner-cli:latest)
/ sonar-scanner -v
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /usr/src/sonar-project.properties
INFO: SonarScanner 4.4.0.2170
INFO: Java 11.0.6 AdoptOpenJDK (64-bit)
INFO: Linux 4.19.76-linuxkit amd64
  • Failed line
@observer
export default class EmptyCache extends Component {
  • Current plugin version from debug output
16:55:35.060 DEBUG:   * JavaScript/TypeScript Code Quality and Security 6.3.0.12464 (javascript)

Does anyone work around the error? I have no control over the plugin version since I am using sonarcloud.io. It seems that the plugin version is supposed to work with javascript decorators.

Thanks for any tips.

Hello @bkim.finxact,

Currently, the parsers we used under the hood for our analyser are not able to parse decorators, which are not part of JavaScript standard yet. Still, we can configure them to support such a feature. I created this ticket in that regard.

Yassin

1 Like

Yassin, thank you very much for following up. I will follow the ticket.