Skip to content

Files

Latest commit

 

History

History
42 lines (29 loc) · 1.06 KB

no-dupe-on-directives.md

File metadata and controls

42 lines (29 loc) · 1.06 KB

Pattern: Duplicate on: directive

Issue: -

Description

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.

🚀 Version

This rule was introduced in eslint-plugin-svelte v2.14.0

🔍 Implementation