question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'foo' is missing in props validation (react/prop-types)

See original GitHub issue

I was having trouble with this (‘post’ is missing in props validation (react/prop-types)):

export default Post = ({ post }) => (
  <div>{post.title}</div>
);

Post.propTypes = {
  post: PropTypes.arrayOf(PropTypes.object).isRequired,
};

but this did not have anymore issues:

const Post = ({ post }) => (
  <div>{post.title}</div>
);

Post.propTypes = {
  post: PropTypes.arrayOf(PropTypes.object).isRequired,
};

export default Post;

And I believe this information could be useful:

armenzg@armenzg-mbp readable-app$ node --version
v8.5.0
armenzg@armenzg-mbp readable-app$ ./node_modules/.bin/eslint --version
v4.7.2
armenzg@armenzg-mbp readable-app$ cat package.json | grep eslint
    "lint": "./node_modules/.bin/eslint src/",
    "eslint": "^4.7.2",
    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.3.0"
armenzg@armenzg-mbp readable-app$ cat .eslintrc.js
module.exports = {
    "extends": "airbnb",
    "rules": {
      "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
      "no-undef": "off",
      "no-console": "off"
    }
};

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alexzherdevcommented, Aug 19, 2018

FWIW (not sure if this is a good indicator of the real situation in this case) Babel transpiles this to

exports.default = Post = function Post() {};

and then

Post = function Post() {};

is a runtime ReferenceError in strict mode.

1reaction
haikyuucommented, Dec 4, 2017

@ljharb done in #1583

Read more comments on GitHub >

github_iconTop Results From Across the Web

React eslint error missing in props validation - Stack Overflow
It can not correctly detect what props were mentioned in propTypes if you have annotated named objects via destructuring anywhere in the class....
Read more >
'(react/prop-types): Missing in props validation' when ... - GitHub
This will give me the error that the props validation is missing. '...' is missing in props validation eslint(react/prop-types) ...
Read more >
How to fix: Prop types validation error - is missing in props ...
To fix the 'React eslint error missing in props validation' when developing a React app, we can set the prop types of the...
Read more >
is missing in props validation(react/prop-types) - You.com
ESLint is just warning you to define a type check for that prop in the component where you are using it. You can...
Read more >
[React] Solution for 'children' is missing in props validation ...
If you came up with this error message “ 'children' is missing in props validation eslint(react/prop-types)” , this article might help.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found