Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.31 KB

no-dupe-on-directives.md

File metadata and controls

56 lines (39 loc) · 1.31 KB
pageClass sidebarDepth title description since
rule-details
0
svelte/no-dupe-on-directives
disallow duplicate `on:` directives
v2.14.0

svelte/no-dupe-on-directives

disallow duplicate on: directives

📖 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.

🚀 Version

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

🔍 Implementation