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

react-hooks-strict-return gets triggered, even in the return of built in hooks like useMemo #370

Open
hagnerd opened this issue Mar 8, 2023 · 0 comments

Comments

@hagnerd
Copy link

hagnerd commented Mar 8, 2023

Overview

The react-hooks-strict-return rule incorrectly gets triggered in built in hook calls (useMemo, useCallback, useState, potentially others).

Example

function useExampleHook(input) {
  const options = useMemo(() => [
    `${input}1`,
    `${input}2`,
    `${input}3`,
    // eslint error gets reported here
  ], [input]);

  
  // ... even if this doesn't return `options` the rule gets triggered.
}

Consuming repo

What repo were you working in when this issue occurred?

The Shopify Web repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant