Skip to content

prop-types not assigned via object literal do not work #355

Closed

Description

The Airbnb styleguide recommends putting proptypes in a variable at the top of the file, and then assigning it into propTypes. This causes the linting of propTypes to fail.

The following does not cause any linting errors, despite not including the proptypes validation.

const propTypes = {};

class Test extends React.Component {
  render() {
    return (
      <div>{this.props.name}</div>
    );
  }
}

Test.propTypes = propTypes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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