-
-
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
Cannot read property 'length' of undefined in lib/rules/prop-types.js line 51 #9
Comments
I'll have a look at it. Can you share the code that trigger this error? |
I'll try to whittle it down. Might take a bit. |
Ah, it looks like it happens when I am defining an object outside of the component to hold the propTypes, and then assigning it to that variable. Something like: const myPropTypes = {
...
};
const MyComponent = React.createClass({
propTypes: myPropTypes,
...
}); |
Ok, I see. I can fix the crash but I am not sure how to check propTypes definition in this case. I need to figure that out. |
Even if I try disabling this rule for the affected file via I've refactored my code so I don't need this anymore, but it would be nice to be able to at least disable this rule on a per-file basis using the comments. |
The same error is happening here: https://github.com/shakacode/react-webpack-rails-tutorial/blob/cd35765c0a0d1a755c30944b4879bc12ca8e8163/client/app/stores/commentsStore.js#L8 This fixes the error, but I don't know exactly why. Any ideas? |
After upgrading from 1.3.0 to 1.4.1, I am getting this error message:
The text was updated successfully, but these errors were encountered: