solidjs-community / eslint-plugin-solid

Solid-specific linting rules for ESLint.
MIT License
216 stars 26 forks source link

Reactivity warns for signals in addEventListener handlers #11

Closed joshwilsonvu closed 2 years ago

joshwilsonvu commented 2 years ago

Describe the bug Event handlers are a special case in the reactivity rule where it's okay to read reactive variables even though the function isn't tracked by Solid. These are already accounted for in certain places:

element.onclick = () => console.log(signal());

<div onClick={() => console.log(signal())} \>

<div on:click={() => console.log(signal())} />

But the following warns:

element.addEventListener("click", () => console.log(signal()));

To Reproduce Configure plugin, check last example.

Expected behavior Event handlers added with addEventListener should be treated as called functions.