#how do I change default comment syntax from `<!--` to use JSX comment style `{/**/ in an .astro file
3 messages · Page 1 of 1 (latest)
Hi @clear stirrup. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the information provided in the extracts, it seems that Astro does not currently support changing the default comment syntax from HTML-style (<!-- -->) to JSX-style ({/**/}) in .astro files.
Astro syntax is similar to JSX, but it does diverge in certain areas. For instance, in Astro, the contents of an expression are treated as Astro-style HTML, not JSX. Therefore, // isn't actually commenting out the script, it's just treated as text before the <script> tag. You'd have to comment out the script using <!-- <script src='<https://xyz.com/evil-script.js'> /> --> (source (https://github.com/withastro/astro/issues/3115)).
In another issue, a user requested support for JS // comments inside JSX-like component templates, but the Astro docs only mention /* */ comments. The user wanted the other comments too, because VS Code sets them on the commenting hotkey (source (https://github.com/withastro/astro/issues/9120)).