sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
306 stars 38 forks source link

Future of `no-not-function-handler` #903

Closed marekdedic closed 2 weeks ago

marekdedic commented 2 weeks ago

Hi, the rule no-not-function-handler is used in Svelte 4 for checking that event callbacks are functions. In Svelte 5, event callbacks are regular props. I think the rule shouldn't be ported to this new event system for several reasons:

  1. You can't really tell which prop is an event callback
  2. Passing non-functions to props which expect a callback is like passing any wrongly typed prop, sou should be caught if you are using TypeScript (and if you are not... well that's your choice, this is exactly the kind of issue that TypeScript was built for...)

What do you think?

ota-meshi commented 2 weeks ago

Yeah. I agree with you, I don't think that rule is very useful.

marekdedic commented 2 weeks ago

Ok, I'll add it to the list in #894.