Content-Length: 1158365 | pFad | https://github.com/jsx-eslint/eslint-plugin-react/issues/1046

96 prop-types validation doesn't run for every stateless component · Issue #1046 · jsx-eslint/eslint-plugin-react · GitHub
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









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/jsx-eslint/eslint-plugin-react/issues/1046

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy