-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
New rule: prefer-event-forwarding
#850
Comments
Svelte 5 is moving into direction of using props for event handlers:
<script>
let { onclick } = $props();
</script>
<button {onclick}>Click me</button> https://svelte-5-preview.vercel.app/docs/event-handlers#bubbling-events So although I agree that using |
Non the less is Svelte 4 supported for the foreseeable future. So I think this should be considered. |
Motivation
In our dev team, some devs tend to redefine event handlers as props which makes code more verbose than it needs to be.
Button.svelte
Instead, we can rely on event forwarding like this:
See more: https://learn.svelte.dev/tutorial/event-forwarding
Description
The rule should report on props that mirror native HTML event handlers and suggest simplifying them with event forwarding.
Examples
Additional comments
No response
The text was updated successfully, but these errors were encountered: