Cannot ignore svelte lint warnings in the script block
Opened this issue · 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
Regarding the "Expected behaviour" part, the svelte-ignore comment can only be an HTML comment. If you wish to be able to only suppress specific lines inside the script tag, please open an issue in the main svelte repo.
Ah. Ignore my previous comment. The js comment does work. But the warning code got renamed a few weeks before so maybe you're referencing the old code?
@jasonlyu123 This is still an issue - you can see the line here where it inserts an html comment. This should insert a JS comment if it's in the JS part of the code.
I didn't say it wasn't. I was addressing the "adding the comment manually does not work either" part.
Got it, it seems like that has been fixed since my original issue yes