# 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 This `on:click` directive is the same and duplicate directives in L10. (svelte/no-dupe-on-directives)on:clickThis `on:click` directive is the same and duplicate directives in L10. (svelte/no-dupe-on-directives) on:click />
<button This `on:click` directive is the same and duplicate directives in L11. (svelte/no-dupe-on-directives)on:click={myHandler}This `on:click` directive is the same and duplicate directives in L11. (svelte/no-dupe-on-directives) on:click={myHandler} />
<input
This `on:focus` directive is the same and duplicate directives in L15. (svelte/no-dupe-on-directives)on:focus|once
This `on:focus` directive is the same and duplicate directives in L14. (svelte/no-dupe-on-directives)on:focus
This `on:keydown` directive is the same and duplicate directives in L17. (svelte/no-dupe-on-directives)on:keydown={() => console.log('foo')}
This `on:keydown` directive is the same and duplicate directives in L16. (svelte/no-dupe-on-directives)on:keydown={() => console.log('foo')}
/>
# 🔧 Options
Nothing.
# 🚀 Version
This rule was introduced in eslint-plugin-svelte v2.14.0