Skip to content

[bug] no-forward-ref rule removes any function named forwardRef #1172

@mcky

Description

@mcky

Describe the bug

I'm working in a monorepo which includes both React and NestJS projects. Nest also exports a function named forwardRef, which the linter over-zealously removes (see the below diff after running eslint --fix

Looking at the rule source, isReactAPI doesn't seem to validate the import actually comes from the react package

I've bypassed it on my end by disabling the rule for that workspace

Image

Reproduction

  1. Create a file with the contents
import { forwardRef } from "not-react"

forwardRef(() => null)
  1. Run eslint --fix

  2. See that the non-react forwardRef has been removed

Image

Expected behavior

Only react APIs are removed

Platform and versions

"@eslint-react/eslint-plugin": "^1.52.2",

Stack trace


Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions