Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.36 KB

no-dupe-on-directives.md

File metadata and controls

53 lines (37 loc) · 1.36 KB
pageClass sidebarDepth title description
rule-details
0
svelte/no-dupe-on-directives
disallow duplicate `on:` directives

svelte/no-dupe-on-directives

disallow duplicate on: directives

  • This rule has not been released yet.

📖 Rule Details

We can define any number of on: directive with the same event name, but duplicate directives with the exact same event name and expression are probably a mistake. This rule reports reports on: directives with exactly the same event name and expression.

<script>
  /* eslint svelte/no-dupe-on-directives: "error" */
</script>

<!-- ✓ GOOD -->
<button on:click on:click={myHandler} />
<button on:click={foo} on:click={bar} />

<!-- ✗ BAD -->
<button on:click on:click />
<button on:click={myHandler} on:click={myHandler} />

<input
  on:focus|once
  on:focus
  on:keydown={() => console.log("foo")}
  on:keydown={() => console.log("foo")}
/>

🔧 Options

Nothing.

🔍 Implementation