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

Gives error on next props #840

Closed
ButuzGOL opened this issue Sep 16, 2016 · 2 comments
Closed

Gives error on next props #840

ButuzGOL opened this issue Sep 16, 2016 · 2 comments

Comments

@ButuzGOL
Copy link

ButuzGOL commented Sep 16, 2016

const { container, ...props } = this.props;
let { category, icon } = props;

for category, icon gives error

@lencioni
Copy link
Collaborator

Hi @ButuzGOL! Can you tell us specifically which rules give you an error here? It might be helpful to include the full output of an ESLint run along with a copy of your ESLint configuration.

@ButuzGOL
Copy link
Author

Config: 'react/no-unused-prop-types': 1,
Example:

import React, { PropTypes, Component } from 'react';

export default class Checkbox extends Component {
  constructor() {
    super();
    this.a = 'a';
  }

  render() {
    const { container, ...props } = this.props;
    const { category, icon } = props;

    return (
      <div>
        {container} {category} {icon}
      </div>
    );
  }
}

Checkbox.propTypes = {
  container: PropTypes.string,
  category: PropTypes.string,
  icon: PropTypes.bool,
};

Output:
src/scripts/Checkbox.js
24:13 warning 'category' PropType is defined but prop is never used react/no-unused-prop-types
25:9 warning 'icon' PropType is defined but prop is never used react/no-unused-prop-types

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

2 participants