Skip to content

[bug] False positive in react-x/no-context-provider #991

@kachkaev

Description

@kachkaev

👋 @Rel1cx!

Describe the bug

react-x/no-context-provider tiggers on symbols named Provider which are imported from third-party libs.

Reproduction

Example:

import { Provider } from "jotai";

function Component() {
  return <Provider>hello world</Provider>;
}

ESLint output:

In React 19, you can render '<Context>' as a provider instead of '<Context.Provider>'.
eslint@eslint-react/no-context-provider

Expected behavior

No error

Platform and versions

@eslint-react/[email protected]

Additional context

Likely cased by #985. The above code snippet works without errors in 1.32.0.

Changing code like this mitigates the error:

import { Provider as JotaiProvider } from "jotai";

function Component() {
  return <JotaiProvider>hello world</JotaiProvider>;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: ReleasedThe issue has been releasedType: BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions