solidjs-community / solidjs-community/eslint-plugin-solid
Add support for destructuring @solidjs/router hooks
@joshwilsonvu is already working on this.
Since Feb 4, 2023.
- Dominant language
- TypeScript
- Stars
- 266
- Forks
- 52
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 9
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.