This is similar to markdown format where the area in the top between the dashes --- is called frontmatter. Frontmatter contains the JavaScript/TypeScript code that will be evaluated and executed. The rest is HTML and JS expressions. To work with Astro, there is an extension provided by the team that provides what a developer requires like syntax highlighting, IntelliSense, autocomplete … etc.
By the end of the day, astro component is no different than any React or Vue component. It just follow a different syntax.
The current version of SonarQube does not analyze the .astro files despite adding these files to the extension list of JavaScript.
Astro is becoming extremely popular tool and a lot of organizations are using it. In this thread I am asking to add support for Astro or if anyone can provide me with guidance on the best approach to support this framework. Should it be done as a new plugin or maybe an update needs to be done to the parser?
Thanks @gab, indeed we tried that recently without success.
I figured adding the .astro extension to the JavaScript file suffixes would do the trick, but no luck.
Is there a setting to make a scan recognize the astro files? As @ahmadalfy put it:
By the end of the day, astro component is no different than any React or Vue component. It just follow a different syntax.
So I would expect Sonar to be able to analyze .astro files as it does with other JS frameworks. I would be fine with a documented workaround such as adding the file extensions to different suffix settings for HTML/JS
The analysis just failed, in any configuration we tried.
EDIT: I just realized this is the SonarQube Server forum – we are using the Cloud product, if that makes a difference at all.
Dear all,
Since a lot of time has passed since this ticket was created and responded. Is there any update of the matter? Do you know if there has been any initiative to support the astro format? Or … does anybody has test again if the javascript scanner supports this format?
No update to share, unfortunately. And I just double checked – SonarQube still can’t parse .astro files when that suffix is added to sonar.javascript.file.suffixes.
21:47:25.734 DEBUG 'src/components/organisms/ContactSection.astro' indexed with language 'null'
21:47:25.736 DEBUG 'src/components/organisms/Footer.astro' indexed with language 'null'
Is there a way to contribute about this? I would love to.