Open marekdedic opened 1 week ago
Hmm. I think it would be useful to have that rule, but I'm worried about whether it's okay to judge all function props as event props 🤔.
What about implementing a rule that checks naming conventions for all props and provides examples for event names in the rule's documentation?
The rule could also disallow the on
prefix for non-function props.
Motivation
In Svelte 5, all HTML element events are props starting with "on". Component events can have any name, so it is not clear, which props are events and which are not.
Description
I'd like to add a rule that requires that all props that are events (i.e. that are functions) start with "on"
Examples
Additional comments
I think this works even without TS, as the type would be in the parsed AST, right?