Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug][svelte/indent] Invalid indentation for children and snippet closing tag #863

Closed
2 tasks done
mikededo opened this issue Sep 26, 2024 · 0 comments · Fixed by #864
Closed
2 tasks done

[bug][svelte/indent] Invalid indentation for children and snippet closing tag #863

mikededo opened this issue Sep 26, 2024 · 0 comments · Fixed by #864

Comments

@mikededo
Copy link
Contributor

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

9.10.0

What version of eslint-plugin-svelte are you using?

2.44.0

What did you do?

Does not work with any configuration, you can try the following example in the current docs.

Code example

Copy the following into the rules docs

<script>
  /* eslint svelte/indent: "error" */
  function click() {}
</script>

<!-- ✓ GOOD -->
<button
  type="button"
  on:click={click}
  class="my-button primally"
>
  CLICK ME!
</button>

<!-- ✗ BAD -->
<button
  type="button"
  on:click={click}
  class="my-button primally"
>
{#snippet example()}
<div>Some code</div>
{/snippet}
{#if true}
<div>Some other code</div>
{/if}
</button>

What did you expect to happen?

To have the indent of the {/snippet} and it's content (basically the div), be properly indented, as the if clause:

Expected result
<script>
  /* eslint svelte/indent: "error" */
  function click() {}
</script>

<!-- ✓ GOOD -->
<button
  type="button"
  on:click={click}
  class="my-button primally"
>
  CLICK ME!
</button>

<!-- ✗ BAD -->
<button
  type="button"
  on:click={click}
  class="my-button primally"
>
  {#snippet example()}
    <div>Some code</div>
  {/snippet}
  {#if true}
    <div>Some other code</div>
  {/if}
</button>

What actually happened?

The {/snippet} indent is not correctly updated

Results
<script>
  /* eslint svelte/indent: "error" */
  function click() {}
</script>

<!-- ✓ GOOD -->
<button
  type="button"
  on:click={click}
  class="my-button primally"
>
  CLICK ME!
</button>

<!-- ✗ BAD -->
<button
  type="button"
  on:click={click}
  class="my-button primally"
>
  {#snippet example()}
<div>Some code</div>
{/snippet}
  {#if true}
    <div>Some other code</div>
  {/if}
</button>

Link to GitHub Repo with Minimal Reproducible Example

ESLint playground example

Additional comments

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant