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

False positives for all functions inside of .tsx/.jsx files that are not react components

Open mrmeku opened this issue 3 years ago • 2 comments

I would love to use this lint rule, but its false positive rate is way to high currently. It seems any function within a jsx/tsx file is considered to be a component regardless of whether it is or not.

If possible, I would use the typescript compiler to check if a function can be considered to be of type FunctionComponent. Doing so, you can safely filter out all false positives.

That being said, I have no idea if the typescript compiler API has such a hook

mrmeku avatar Aug 13 '21 21:08 mrmeku

+1 on this, also seeing the same issue

richardvclam avatar Oct 05 '21 17:10 richardvclam

Components always start with a capital letter. I haven't extensively looked at the plugin, though such a filter might work.

If not putting your logic in .ts files might be cleaner.

hellowodl avatar Jul 21 '22 17:07 hellowodl