# svelte/no-unused-svelte-ignore
disallow unused svelte-ignore comments
- βοΈ This rule is included in
"plugin:svelte/recommended".
# π Rule Details
This rule warns unnecessary svelte-ignore comments.
svelte-ignore comments can include an explanatory note in parentheses after the warning names.
This rule checks only the warning names and ignores the explanatory note.
<script>
/* eslint svelte/no-unused-svelte-ignore: "error" */
</script>
<!-- β GOOD -->
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<img src="https://example.com/img.png" autofocus />
<!-- svelte-ignore a11y-autofocus, a11y-missing-attribute (intentional for this example) -->
<img src="https://example.com/img.png" autofocus />
<!-- β BAD -->
<!-- svelte-ignore svelte-ignore comment is used, but not warned (svelte/no-unused-svelte-ignore)a11y-autofocussvelte-ignore comment is used, but not warned (svelte/no-unused-svelte-ignore) a11y-missing-attribute -->
<img src="https://example.com/img.png" alt="Foo" />
# Runtime warnings
Svelte v5 also lets you use svelte-ignore to silence some runtime warnings, such as ownership_invalid_binding.
The compiler never reports these warnings, so this rule canβt tell whether the comment is used.
This rule doesnβt report these codes, even if the comment is in the wrong place.
But in runes mode, Svelte ignores some of these codes, so this rule still reports them:
- The kebab-case form (e.g.
ownership-invalid-binding). - Codes after a code that isnβt followed by a comma. Svelte reads the rest of the comment as prose (e.g.
ownership_invalid_bindinginsvelte-ignore a11y_autofocus ownership_invalid_binding).
# π§ Options
Nothing.
# π Further Reading
# π Version
This rule was introduced in eslint-plugin-svelte v0.19.0