rrousselGit / flutter_hooks

React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.
MIT License
3.12k stars 178 forks source link

Linters like those for javascript react hooks? #285

Open fzyzcjy opened 2 years ago

fzyzcjy commented 2 years ago

Hi thanks for the lib! In JS, we have https://www.npmjs.com/package/eslint-plugin-react-hooks linters for enforcing the rules of hooks https://reactjs.org/docs/hooks-rules.html (the rules are mostly the same as here). So I wonder whether we can have one? Thanks!

rrousselGit commented 2 years ago

It's been on my todo-list for a while. It's possible, but not my priority

fzyzcjy commented 2 years ago

@rrousselGit I can contribute for it. Could you please provide some hints about how you would like to implement it?

rrousselGit commented 2 years ago

Someone started working on one already https://github.com/mj-hd/flutter_hooks_lint_plugin

I'd reach out to them first to see whether we can merge efforts and make an official solution.

fzyzcjy commented 2 years ago

Sounds great. Thanks!

satvikpendem commented 1 year ago

Is this still being worked on? I saw that the one linked above doesn't work with the new lints for riverpod since now Dart only allows one linter. Looks like they're not working on their flutter_hooks linter anymore, wondering if there is an official solution now.

rrousselGit commented 1 year ago

There's no official solution for now.

burhanyasar commented 5 months ago

Here is another library, which seems to be more actively maintained: https://pub.dev/packages/flutter_hooks_lint

I just started adding hooks in a project and basic hook usage checks seem to work well. Calling them outside the build functions or calling them conditionally etc.