Skip to content

prop-types validation doesn't run for every stateless component #1046

Closed
@prithsharma

Description

@prithsharma

Test case -
If a function is of the form

() => {
  return <some_jsx />;
}

the prop-types rule is checked as expected.

But if the function is of the form

() => {
  const returnValue = <some_jsx />;
  return returnValue;
}

it seems the the prop-types rule is not checked and no lint errors are thrown if there are no propType validations.

Possible reason - Referring to this comment, I think the plugin identifies a function as a React component if it returns some JSX. In the case above, the plugin somehow fails to identify it as returning some JSX.

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