solidjs-community / eslint-plugin-solid

Solid-specific linting rules for ESLint.
MIT License
220 stars 27 forks source link

`solid/reactivity` warning when using props as dependency(ies) in `on()` #105

Closed drgarlic closed 9 months ago

drgarlic commented 1 year ago

Describe the bug

ESLint shows a warning:

This function should be passed to a tracked scope (like createEffect) or an event handler because it contains reactivity, or else changes will be ignored.eslintsolid/reactivity

When using a prop or several props as dependency(ies) in on() like so:

createEffect(
    on(
      () => props.show,
      (show) => show && setState('zIndex', 100),
    ),
  )

To Reproduce

The upper code

Expected behavior

To not show a warning when the code is right

Screenshots

Screenshot 2023-08-21 at 11 38 47

Environment (please complete the following information):

Additional context

joshwilsonvu commented 9 months ago

Looks like I can no longer reproduce this, must have fixed the issue. Feel free to reopen if I'm mistaken.

https://playground.solidjs.com/anonymous/c8858afd-2aa7-4366-9af0-977e650915ea