Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for destructuring @solidjs/router hooks #72

Open
1 task done
blarfoon opened this issue Feb 4, 2023 · 0 comments
Open
1 task done

Add support for destructuring @solidjs/router hooks #72

blarfoon opened this issue Feb 4, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request reactivity v2 To be addressed in the rewrite of the solid/reactivity rule

Comments

@blarfoon
Copy link

blarfoon commented Feb 4, 2023

Describe the need
At the moment, the destructuring error only appears for props. It's an issue for any reactive value being destructured though. This happened to me while using @solidjs/router's useParams

const MyComponent = () => {
  const { id } = useParams();
  ...

which should not be destructured. I understand it's impossible to detect what is reactive and what not from the eslint plugin, but maybe adding support for @solidjs/router would be a cool addition.

Suggested Solution
Add support for @solidjs/router, by detecting destructures on its hooks.

Possible Alternatives
Maybe detect function hooks being called inside a component that start with create or use? Pretty heuristic though.
Another solution could be to prevent all destructures in the form of let/consts/var {...} = ..., maybe though an option in eslint config?

  • I would be willing to contribute a PR to implement this feature

Yes, even tho I would need a few indications on how to approach the problem

@blarfoon blarfoon added the enhancement New feature or request label Feb 4, 2023
@joshwilsonvu joshwilsonvu added the reactivity v2 To be addressed in the rewrite of the solid/reactivity rule label Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reactivity v2 To be addressed in the rewrite of the solid/reactivity rule
Projects
None yet
Development

No branches or pull requests

2 participants