solidjs-community / eslint-plugin-solid

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

False positive in standard `*Observer` web APIs #81

Closed macarie closed 1 year ago

macarie commented 1 year ago

Describe the bug

I believe callbacks for the *Observer category of web APIs should be treated like those for setTimeout and friends and not marked as untracked.

To Reproduce

const [signal] = createSignal(5);

new IntersectionObserver(() => console.log(signal()));
new MutationObserver(() => console.log(signal()));
new PerformanceObserver(() => console.log(signal()));
new ReportingObserver(() => console.log(signal()));
new ResizeObserver(() => console.log(signal()));

Expected behavior

Using signals in these kinds of callbacks should not generate a warning.

Screenshots Rule "solid/reactivity" gives a warning that reads "This function should be passed to a tracked scope (like createEffect) or an event handler because it contains reactivity." for the code provided above