Skip to content

jsx-uses-vars rule doesn't work with ES6 class #96

Closed
@haoqunjiang

Description

@haoqunjiang

With [email protected] & [email protected]

$ cat hello.jsx

class HelloMessage extends React.Component {
    static get propTypes() {
        return {
            name: React.PropTypes.oneOfType([
                React.PropTypes.string,
                React.PropTypes.number
            ])
        };
    }
    render() {
        return <div>Hello {this.props.name}</div>;
    }
}

React.render(<HelloMessage name='world' />, document.querySelector('#content'));

$ cat .eslintrc

parser:
    babel-eslint

env:
    browser: true
    es6: true

plugins:
    - react

globals:
    React: true

rules:
    strict: 0
    quotes: [1, single, avoid-escape]
    indent: [1, 4]
    quote-props: [1, as-needed]
    no-unused-expressions: 1
    react/jsx-no-undef: 1
    react/jsx-quotes: [1, single, avoid-escape]
    react/jsx-uses-react: 1
    react/jsx-uses-vars: 1
    react/prop-types: 1
    react/react-in-jsx-scope: 1

$ eslint hello.jsx

hello.jsx
  1:6  error  HelloMessage is defined but never used  no-unused-vars

✖ 1 problem (1 error, 0 warnings)

Is that a bug of this plugin?

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