solidjs-community / eslint-plugin-solid

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

solid/reactivity rule does not report nested signal call in non tracked scope #124

Closed Tronikelis closed 6 months ago

Tronikelis commented 6 months ago

Describe the bug Best way to explain is an example

https://playground.solidjs.com/anonymous/695d5961-9a9d-4422-8d72-e1d8f06cf98e

function useExample(input: number | number[]) {}

function Counter(props: ComponentProps<"button">) {
  const [c, setC] = createSignal(1);

  // reports, nice
  useExample(c());
  // does not report
  useExample([c()]);

  return <div>hello</div>;
}

Expected behavior Should report for both of them

Environment (please complete the following information):

joshwilsonvu commented 6 months ago

Hmm, thanks for this. Looks like in an attempt to allow code like

useExample([() => c()])

I inadvertently allowed code like useExample([c()]). Will just need to tighten up the checks for custom hooks—they're meant to be pretty permissive, but definitely not meant to allow incorrect code like this.

Tronikelis commented 6 months ago

thanks