react-contexify icon indicating copy to clipboard operation
react-contexify copied to clipboard

ESLint error for useContextMenu's show function

Open thSoft opened this issue 5 years ago • 0 comments

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

ESLint signals an error for this line with the @typescript-eslint plugin:

const { show } = useContextMenu();

error Avoid referencing unbound methods which may cause unintentional scoping of `this` @typescript-eslint/unbound-method

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your CodeSandbox (https://codesandbox.io/s/new) example below:

The following could be the cause of the problem: https://stackoverflow.com/questions/62864908/how-to-prevent-typescript-eslint-unbound-method-errors-on-non-class-typescrip

What is the expected behavior?

There is no ESLint error.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

This is a compile-time problem.

thSoft avatar Mar 11 '21 16:03 thSoft