Skip to content

jsx-uses-vars is confused by shadowed variables. #799

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

Closed
Wilfred opened this issue Aug 31, 2016 · 1 comment
Closed

jsx-uses-vars is confused by shadowed variables. #799

Wilfred opened this issue Aug 31, 2016 · 1 comment

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Aug 31, 2016

Given the following code:

import React from 'react';
import {FooPicker} from '../FooPicker';

function myTest() {
  const FooPicker = require('../FooPicker').default;
  return <FooPicker />;
}

myTest();

and the following .eslintrc.json:

{
    "env": {
        "node": true
    },
    "parserOptions": {
        "ecmaVersion": 6,
        "ecmaFeatures": {
            "jsx": true,
            "impliedStrict": true
        },
        "sourceType": "module"
    },
    "rules": {
        "no-unused-vars": "warn",
        "react/jsx-uses-vars": "warn",
        "react/jsx-uses-react": "warn"
    },
    "plugins": [
        "react"
    ]
}

No warnings are generated. We should warn on the import {FooPicker}, as it's unused.

Possibly related: #716.

@Wilfred
Copy link
Contributor Author

Wilfred commented Sep 13, 2016

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant