solidjs-community / eslint-plugin-solid

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

First argument to mapArray should be recognised as a tracked scope #55

Closed jfrere closed 1 year ago

jfrere commented 1 year ago

Describe the bug

The first argument to mapArray is a function that is run within a tracked scope, but eslint-plugin-solid does not recognise it as a tracked scope.

To Reproduce

export function createCustomStore(): Accessor<CustomItem[]> {
  const [store, updateStore] = createStore({
    /* ... */
  });

  return mapArray(
    // warning: This function should be passed to a tracked scope (like createEffect) or an event handler because it contains reactivity (solid/reactivity)
    () => store.path.to.field,
    (item) => ({
      /* ... */
    })
  );
}

Expected behavior

mapArray should be recognised as using tracked scopes.

Environment (please complete the following information):

Additional context

I've split this problem off from #52 as discussed there