Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add onlyImported flag for jsx-no-undef #922

Closed
nkt opened this issue Oct 20, 2016 · 2 comments
Closed

Add onlyImported flag for jsx-no-undef #922

nkt opened this issue Oct 20, 2016 · 2 comments

Comments

@nkt
Copy link

nkt commented Oct 20, 2016

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.
@nkt nkt changed the title Add jsx-no-undefined rule Add onlyImported flag for jsx-no-undef Oct 20, 2016
@ljharb
Copy link
Member

ljharb commented Oct 20, 2016

This is a great solution to this problem for React.

@alexzherdev
Copy link
Contributor

Fixed in #1013 ?

@ljharb ljharb closed this as completed Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants