I have a component that is giving me false positives saying that a proptype is not defined.
'children' is missing in props validation react/prop-types
Here's an example
import React from 'react';
import PropTypes from 'prop-types';
import makeHoc from './make-hoc';
import selectors from './selectors';
class Foo extends React.Component {
render() {
return this.props.children;
}
}
Foo.propTypes = {
children: PropTypes.element.isRequired
};
export const Unconnected = Foo; //this line causes the issue
export default makeHoc(
Foo,
selectors
);
and it works if I change commented line above to this
export { Foo as Unconnected };
At first I thought #1958 was related but on second look it doesn't seem to be. I also tried downgrading to 7.10.0 and that didn't help.
I don't see anything wrong with that syntax, but please point out if I'm missing something. Thanks!
Certainly the as version is better, since it doesn't create an additional binding inside your module, but the = version should still work.
Agreed. But figured it was still a bug so I'd report it.
Hmm I pasted this entire example as a test for 7.11.1 and it passed
In that case let鈥檚 add the test case in a PR and close the issue. It鈥檚 possible this is a bug fixed in master but not yet released.
oh cool, according to the build in #2068 this does fail on ESLint 5.
Also, this has been filed before in #1957