eslint-plugin icon indicating copy to clipboard operation
eslint-plugin copied to clipboard

Rule: `exhaustive-keys-for-useStoreMap`

Open igorkamyshev opened this issue 4 years ago • 5 comments

useStoreMap can use keys-parameter for memorize result. It passes this array to React.useMemo to skip unnecessary re-renders. We can write a rule to detect possible errors in keys. This rule is highly inspired by https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js

igorkamyshev avatar Aug 28 '21 11:08 igorkamyshev

Hi! Looks like this rule can be very useful. How can I help you with it?

binjospookie avatar Oct 25 '21 13:10 binjospookie

@binjospookie hi. If you have enough time, you can take this PR (#65) and finish it.

The main idea is checking that all variables in fn of useStoreMaps have taken from arguments. It's a pretty simple check. However, in my opinion, it's enough for the first approach.

igorkamyshev avatar Oct 26 '21 08:10 igorkamyshev

@binjospookie will you handle this, right?

I've returned from a holiday and ready to make new rules 🌚

igorkamyshev avatar Nov 03 '21 08:11 igorkamyshev

Yes, you're right.

I'm going to do it starting Thursday. Oh, these holidays in Russia 😁

binjospookie avatar Nov 03 '21 08:11 binjospookie

Ok 🙏

igorkamyshev avatar Nov 03 '21 08:11 igorkamyshev