Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

ESLint and PropTypes #65

Open
emipc opened this issue Mar 13, 2018 · 0 comments
Open

ESLint and PropTypes #65

emipc opened this issue Mar 13, 2018 · 0 comments
Assignees

Comments

@emipc
Copy link

emipc commented Mar 13, 2018

I'm using ESLint in my project and it was throwing me some errors related to props missing in props validation.

e.g. This is what the original source code looks like for StateEditor.js:

SlateEditor.propTypes = {
  initialState: PropTypes.object
}

And I've added the missing props like these ones:

SlateEditor.propTypes = {
	initialState: PropTypes.object,
	onChange: PropTypes.func.isRequired,
	plugins: PropTypes.array,
	children: PropTypes.node.isRequired,
};

SlateEditor.defaultProps = {
	plugins: [],
	initialState: undefined
};

Nevertheless, I'm getting this warning:

Warning: Failed prop type: The prop onChange is marked as required in SlateEditor, but its value is undefined.

I've added a console.log to ensure onChange exists and it does.

Do you know why it's throwing me this warning?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants