sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
276 stars 29 forks source link

Svelte5: Add `svelte/no-legacy-svelte-ignore` rule #773

Open ota-meshi opened 3 weeks ago

ota-meshi commented 3 weeks ago

Motivation

Svelte v5 changed the format of error codes to snake_case, but svelte-ignore still works for the previous kebab-case error codes. However, I expect support for the old format will be removed eventually. The new rule help with this migration.

Description

The new rule disallow svelte-ignore using old-style error codes. Note, however, that they will only be reported if you are using Svelte v5 or later.

Examples

<!-- ✓ GOOD -->
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<span tabindex="0">
    <span class="element"></span>
</span>
<div>
    <!-- svelte-ignore block_empty -->
    {#await Promise.resolve(foo)}
    {/await}
</div>

<!-- ✗ BAD -->
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<span tabindex="0">
    <span class="element"></span>
</span>
<div>
    <!-- svelte-ignore empty-block -->
    {#await Promise.resolve(foo)}
    {/await}
</div>

Additional comments

No response