Skip to content

svelte-check --incremental / --tsgo silently drops all diagnostics when a .svelte file has an HTML comment containing JSDoc #2995

Description

@jazoom

Describe the bug

When a .svelte file begins with an HTML comment wrapping a JSDoc block like this:

  <!--
  /**
   * @component MyComponent
   * @description Some description.
   */
  -->

  <script lang="ts">
    // ...
  </script>

the svelte2tsx emit in --incremental / --tsgo mode generates a malformed .svelte.ts file containing nested
JSDoc:

  /**
   * /**
   * * MyComponent
   * * Some description.
   * */
   */

This produces syntax errors (TS1109, TS1161) in the generated file, which causes the spawned tsc / tsgo
process to fail in a way that silently suppresses all other diagnostics — including errors in completely
unrelated .ts and .svelte files. svelte-check then reports 0 errors and 0 warnings.

Normal mode (without --incremental / --tsgo) is unaffected because it uses the language server path rather than the generated overlay project.

Reproduction

  1. Create a .svelte file with an HTML comment containing a JSDoc block (as above)
  2. Introduce a type error in any other .ts or .svelte file
  3. Run svelte-check --tsconfig tsconfig.json --incremental (or --tsgo)
  4. Observe 0 errors — the type error is silently missed
  5. Remove the HTML-wrapped JSDoc comment and rerun — the error is now reported

Expected behaviour

If this type of comment is not allowed, it should raise an error. If it is allowed, it should be handled correctly.

System Info

  • OS: CachyOS (Arch)
  • IDE: N/A

Which package is the issue about?

svelte-check

Additional Information, eg. Screenshots

svelte-check version 4.4.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions