-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False Positive: "react/prop-types [PROP_NAME] is missing in props validation" when using stateless components + destructured param + Flow #498
Comments
is there any update or solution for this issue ?? |
It’s been fixed for years. Please file a new issue if you’re having trouble. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm using eslint-plugin-react 7.20.3 and I'm having the same issue, do you have any idea of what should do? |
@ExpectoPatrom would you mind filing a new issue? please include the code and the warnings. |
@ExpectoPatrom same here |
I can confirm this is happening for me on ^7.21.5 |
Hey, nope. It seems like this is not a bug, instead it's kind a bad practice and there's another way of doing the components. I can't remember it specifically but I'm gonna search and then I post it |
This is happening to me whether I destructure props or not, is anyone else facing this issue? |
@alielkhateeb please file a new issue |
Very confusing! Still reports error on eslint-plugin-react": "^7.23.1", AppProvider.propTypes = {
children: PropTypes.any.isRequired,
};
|
@denven please file a new issue. |
How is this still an issue after 5 years? `interface Props { const SomeHandlerComponent: FC = ({ children }) => {` ESLint 2.1.23 |
This is still an issue? |
this will fail, complaining that text, callback isn't prop validated, this resulted in
const Markdown: React.FC<MarkdownProps> = ({ text, callback }: MarkdownProps): React.ReactElement => {
const settings = {
createElement: React.createElement,
components: {},
elements: {
p(props) {
// return some component
},
},
};
const compile = marksy(settings);
const description = compile(text).tree;
return <div className="markdown">{description}</div>;
}; this will be accepted as valid though const p: React.FC = ()=>{};
const Markdown: React.FC<MarkdownProps> = ({ text, callback }: MarkdownProps): React.ReactElement => {
const settings = {
createElement: React.createElement,
components: {},
elements: {
p,
},
};
const compile = marksy(settings);
const description = compile(text).tree;
return <div className="markdown">{description}</div>;
}; I was able to repeatedly repoduce between these two scenarios using react 16 + eslint-plugin-react 7.26.0 |
@PerfectionVR can you file this as a new issue? |
This comment was marked as outdated.
This comment was marked as outdated.
any solution for " 'prop' is mssing in prop validation " error except disabling prop types |
@ideepakpg please file a new issue and i'll take a look |
Similar to #467, I found a minor bug with stateless components with flow annotations.
This is caused because of destructuring, when I don't destructure the props all is fine:
The text was updated successfully, but these errors were encountered: