You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello 👋
I'm not 100% sure whether this is a bug and how to treat that. There're some issues with heurisitc that decides whether something is component or not. I'm using this plugin within my Remix app and stuff like Remix loader and action which are functions exported from route modules are sometimes flagged as components.
I've tried to dive into what exactly causes that and one thing that caught me off guard is the fact that me using satisfies impact this somehow?
Screenshots using the built-in debug config:
While typing these functions with satisfies they're somehow inferred as components?
When they're typed exactly the same, but I'm not using satisfies they aren't identified as components:
This causes problems with some issues e.g. "prefer readonly props". Thanks in advance for looking into it and for the time spent on this plugin 😃
Thank you for providing the reproduction and it's good to see someone actually using the debug rules.
You are correct; these functions should not be marked as components. This is indeed a bug.
It appears that when accessing the parent node to retrieve the function's variable name and checking its capitalization, we did not account for cases where it is wrapped by TypeScript's as and satisfies expressions, which affected the component detection.
Describe the bug
Hello 👋
I'm not 100% sure whether this is a bug and how to treat that. There're some issues with heurisitc that decides whether something is component or not. I'm using this plugin within my Remix app and stuff like Remix
loader
andaction
which are functions exported from route modules are sometimes flagged as components.I've tried to dive into what exactly causes that and one thing that caught me off guard is the fact that me using
satisfies
impact this somehow?Screenshots using the built-in debug config:
While typing these functions with
satisfies
they're somehow inferred as components?When they're typed exactly the same, but I'm not using
satisfies
they aren't identified as components:This causes problems with some issues e.g. "prefer readonly props". Thanks in advance for looking into it and for the time spent on this plugin 😃
Reproduction
Here's a repository with the debug rules setup - https://github.com/pawelblaszczyk5/react-eslint-x-repro
app/root.tsx
file has these exports typed withsatisfies
app/routes/_index.tsx
don't usesatisfies
Expected behavior
These functions ideally wouldn't be marked as components, using/not using satisfies shouldn't impact the way they're identified under the hood?
Platform and versions
Stack trace
Additional context
n/a
The text was updated successfully, but these errors were encountered: