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

Tslint warnings #14

Open
cruiserkernan opened this issue Oct 15, 2019 · 1 comment
Open

Tslint warnings #14

cruiserkernan opened this issue Oct 15, 2019 · 1 comment

Comments

@cruiserkernan
Copy link

cruiserkernan commented Oct 15, 2019

Hi

We have strict tslint/eslint rules and noticed that the react-async-hook code produces these warnings.

  Line 126:  React Hook useCallback has a missing dependency: 'options'. Either include it or remove the dependency array. If 'setValue' needs the current value of 'options', you can also switch to useReducer instead of useState and read 'options' in the reducer  react-hooks/exhaustive-deps
  Line 132:   React Hook useCallback has a missing dependency: 'options'. Either include it or remove the dependency array. If 'setValue' needs the current value of 'options', you can also switch to useReducer instead of useState and read 'options' in the reducer  react-hooks/exhaustive-deps
  Line 137:   React Hook useCallback has a missing dependency: 'options'. Either include it or remove the dependency array. If 'setValue' needs the current value of 'options', you can also switch to useReducer instead of useState and read 'options' in the reducer  react-hooks/exhaustive-deps
  Line 249:   React Hook useEffect was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies
               react-hooks/exhaustive-deps
  Line 249:   React Hook useEffect has missing dependencies: 'executeAsyncOperation', 'isMounting', 'normalizedOptions.executeOnMount', 'normalizedOptions.executeOnUpdate', and 'params'. Either include them or remove the dependency array
               react-hooks/exhaustive-deps

Is it save to include the dependencies that are missing or will that cause unexpected behaviour?

Thanks
/Martin

@slorber
Copy link
Owner

slorber commented Oct 17, 2019

thanks for reporting this

I often don't follow this eslint rule, you can check facebook/react#16956 to understand why. Will consider finding another option if needed

BTW how it comes your tslint setup does check library code, isn't it supposed to only check your own code?

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

No branches or pull requests

2 participants