solidjs-community / eslint-plugin-solid

Solid-specific linting rules for ESLint.
MIT License
209 stars 24 forks source link

Allow forwarding event handlers without wrapper function in Components #49

Closed joshwilsonvu closed 1 year ago

joshwilsonvu commented 1 year ago

Closes #48. solid/reactivity has a warning in place to let people know about the following:

Events are never rebound and the bindings are not reactive, as it is expensive to attach and detach listeners. Since event handlers are called like any other function each time an event fires, there is no need for reactivity; shortcut your handler if desired.

However, a demo revealed that this doesn't apply to components, and passing a function-valued prop as an expression (ex. <Comp onClick={props.onClick}) works normally. I adjusted the rule to treat event handlers on components the same as other props.

baptisteArno commented 1 year ago

Any update on this? 😀