react-async-hook icon indicating copy to clipboard operation
react-async-hook copied to clipboard

Tslint warnings

Open cruiserkernan opened this issue 6 years ago • 1 comments

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

cruiserkernan avatar Oct 15 '19 09:10 cruiserkernan

thanks for reporting this

I often don't follow this eslint rule, you can check https://github.com/facebook/react/issues/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?

slorber avatar Oct 17 '19 09:10 slorber