Skip to content

Add onlyImported flag for jsx-no-undef #922

Closed
@nkt

Description

@nkt

There is component named Text in my project. ESLint doesn't tell me that Text is undefined because it's existing class in the DOM API.
I suggest add rule which deny use components defined globally:

{
  "rules": {
    "react/jsx-no-undef": ["error", { "onlyImported": true }]
  }
}
import Text from './Text';

<Text /> // ok
<Text /> // react/jsx-no-undef: 'Text' component not found in current scope.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions