language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Cannot ignore svelte lint warnings in the script block

Open ottomated opened this issue 1 year ago • 5 comments

Describe the bug

If you quick fix a lint warning in a script block, it inserts an HTML comment at the bottom instead of a JS comment in the right place.

Reproduction

<script>
   let s = $state(0);
   console.log(s);
//             ^
// State referenced in its own scope will never update.
// Did you mean to reference it inside a closure?
// svelte(static_state_reference)
</script>

<!-- using the quick fix inserts this line -->
<!-- svelte-ignore static_state_reference -->
<p>{s}</p>

Expected behaviour

Desired output:

<script>
   let s = $state(0);
   // svelte-ignore static_state_reference
   console.log(s);
</script>

<p>{s}</p>

Note also that adding the comment manually does not work either.

System Info

  • OS: Linux
  • IDE: VSCode

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

ottomated avatar Apr 28 '24 01:04 ottomated