typescript:S6747 bug because of parse error

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    • SonarQube v10.6
  • how is SonarQube deployed: zip, Docker, Helm
    • Docker
  • what are you trying to achieve
    • Scanning a frontend repo using react and seeing that the parser seems to be broken for certain things like < th key=... gives Unknown property 'h k' found.

  • what have you tried so far to achieve this
    • Will probably disable the rule typescript:S6747 to get rid of these errors, there’s quite a few different ones similar to this.

Hi,

Welcome to the community!

Can you tell me why you think the parser is broken? Typically when parsing fails, there are no issues in the file after the point where that happened. On the contrary, having this issue indicates to me that parsing worked.

 
Ann

Hi,

My assumption was that the parsers returns ‘h k’ instead of ‘key’ which I assume is what it wants to? But doesn’t have to be the parsers, I don’t know the system underneath, the point is only that ‘h k’ is not a property so something seems wrong.

1 Like

Hi,

Thanks for the explanation. I did notice that the issue message doesn’t seem to match up with the highlighted code, but… I’m not a TypeScript developer. :sweat_smile:

I’ve flagged this for the language experts.

 
Ann

Hello Elon,

Thank you for the feedback. What is the issue that is raised in SonarQube? Is it S6747?

There is also a parsing error issue, which is raised at the file level S2260, but I believe it is not the case here, right?

Could you share the contents of the file or a redacted sample where you can reproduce the error?

Hi,

Yes S6747. I might be able to add the code later but we’ve had so many of these that I’d assume it’s not so hard to reproduce unless all of our projects have the same kind of issue. In general our projects are using nextjs, react and emotionjs of that helps.