Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix required prop types for classes with annotated methods.
The `react/prop-types` rule incorrectly considers flow type annotations on class methods with arguments named `props` as prop type declarations for the class, even though flow itself gives them no such weight. When a react component is defined as a class extending `React.Component`, and it defines a method that takes an annotated argument named `props`, then, even though flow still thinks the props have `any` type, the `prop-types` rule will not produce 'missing in props validation' errors. A pattern that gets used a lot in React components is as follows: ```javascript type Props = {...}; class Comp extends React.Component { constructor(props: Props) { super(props); // do something... } // ... } ``` which makes this especially nefarious.
- Loading branch information