lukastaegert/eslint-plugin-tree-shaking

Feature request: Support React.forwardRef

igoldny opened this issue · 0 comments

Expected

using React.forwardRef shouldn't be a sideEffect and eslint rule should pass on component using React.forwardRef.

Actual

when using React.forwardRef with types in typescript files eslint rule fail on: Cannot determine side-effects of mutating function return value - eslint(tree-shaking/no-side-effects-in-initialization)

for example:
ErrorPage.js: (rule pass)

const ErrorPage = React.forwardRef((props, ref) => (
  <div {...props} ref={ref} />
));

ErrorPage.tsx: (rule fails)

const ErrorPage = React.forwardRef<HTMLDivElement, ErrorPageProps>(
  (props, ref) => <div {...props} ref={ref} />
);